diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-12-01 21:26:58 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-12-01 21:26:58 +0900 |
| commit | f0f4f8f703b8c927fe8008daecb2d0547d486973 (patch) | |
| tree | aa9f93e55f375f342cc72fb62b5d1cca240c07be /src/HttpResponse.cc | |
| parent | 6bc215fcec22d8bdf760c78cc25cb8798266c8a5 (diff) | |
Added more error code values.
I have not set error code for all exception invocation.
In this change, I set error code where error likely occurs.
Diffstat (limited to 'src/HttpResponse.cc')
| -rw-r--r-- | src/HttpResponse.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/HttpResponse.cc b/src/HttpResponse.cc index 6ce8be89..8ec7d257 100644 --- a/src/HttpResponse.cc +++ b/src/HttpResponse.cc @@ -50,6 +50,7 @@ #include "AuthConfigFactory.h" #include "AuthConfig.h" #include "ChunkedDecodingStreamFilter.h" +#include "error_code.h" #ifdef HAVE_LIBZ # include "GZipDecodingStreamFilter.h" #endif // HAVE_LIBZ @@ -70,14 +71,16 @@ void HttpResponse::validateResponse() const } if(statusCode == 304) { if(httpRequest_->getIfModifiedSinceHeader().empty()) { - throw DL_ABORT_EX("Got 304 without If-Modified-Since"); + throw DL_ABORT_EX2("Got 304 without If-Modified-Since", + error_code::HTTP_PROTOCOL_ERROR); } } else if(statusCode == 301 || statusCode == 302 || statusCode == 303 || statusCode == 307) { if(!httpHeader_->defined(HttpHeader::LOCATION)) { - throw DL_ABORT_EX(fmt(EX_LOCATION_HEADER_REQUIRED, statusCode)); + throw DL_ABORT_EX2(fmt(EX_LOCATION_HEADER_REQUIRED, statusCode), + error_code::HTTP_PROTOCOL_ERROR); } return; } else if(statusCode == 200 || statusCode == 206) { @@ -97,7 +100,8 @@ void HttpResponse::validateResponse() const } } } else { - throw DL_ABORT_EX(fmt("Unexpected status %d", statusCode)); + throw DL_ABORT_EX2(fmt("Unexpected status %d", statusCode), + error_code::HTTP_PROTOCOL_ERROR); } } |
