summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-08-29 10:40:44 +0000
committerChris Wilson <chris+github@qwirx.com>2015-08-29 10:40:44 +0000
commit4822b1e6ee853328a32551ec69d97573f2ea371e (patch)
treeb5e59c7efd1a8725396f5da0a14b27f5c246573c /lib
parent97a817fdfcf53ee2598d315b43d872cd34f02585 (diff)
Improve exception messages in HTTPRequest as well
Diffstat (limited to 'lib')
-rw-r--r--lib/httpserver/HTTPRequest.cpp17
-rw-r--r--lib/httpserver/S3Client.cpp1
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/httpserver/HTTPRequest.cpp b/lib/httpserver/HTTPRequest.cpp
index a4631c2b..1e3e2694 100644
--- a/lib/httpserver/HTTPRequest.cpp
+++ b/lib/httpserver/HTTPRequest.cpp
@@ -267,7 +267,9 @@ bool HTTPRequest::Receive(IOStreamGetLine &rGetLine, int Timeout)
int major, minor;
if(::sscanf(requestLinePtr + p + 5, "%d.%d", &major, &minor) != 2)
{
- THROW_EXCEPTION(HTTPException, BadRequest)
+ THROW_EXCEPTION_MESSAGE(HTTPException, BadRequest,
+ "Unable to parse HTTP version number: " <<
+ requestLinePtr);
}
// Store version
@@ -276,7 +278,9 @@ bool HTTPRequest::Receive(IOStreamGetLine &rGetLine, int Timeout)
else
{
// Not good -- wrong string found
- THROW_EXCEPTION(HTTPException, BadRequest)
+ THROW_EXCEPTION_MESSAGE(HTTPException, BadRequest,
+ "Unable to parse HTTP request line: " <<
+ requestLinePtr);
}
}
@@ -343,7 +347,8 @@ bool HTTPRequest::Receive(IOStreamGetLine &rGetLine, int Timeout)
if(r == 0)
{
// Timeout, just error
- THROW_EXCEPTION(HTTPException, RequestReadFailed)
+ THROW_EXCEPTION_MESSAGE(HTTPException, RequestReadFailed,
+ "Failed to read complete request with the timeout");
}
decoder.DecodeChunk(buf, r);
bytesToGo -= r;
@@ -423,7 +428,8 @@ bool HTTPRequest::Send(IOStream &rStream, int Timeout, bool ExpectContinue)
case HTTPVersion_1_0: rStream.Write("HTTP/1.0"); break;
case HTTPVersion_1_1: rStream.Write("HTTP/1.1"); break;
default:
- THROW_EXCEPTION(HTTPException, NotImplemented);
+ THROW_EXCEPTION_MESSAGE(HTTPException, NotImplemented,
+ "Unsupported HTTP version: " << mHTTPVersion);
}
rStream.Write("\n");
@@ -454,7 +460,8 @@ bool HTTPRequest::Send(IOStream &rStream, int Timeout, bool ExpectContinue)
if (mpCookies)
{
- THROW_EXCEPTION(HTTPException, NotImplemented);
+ THROW_EXCEPTION_MESSAGE(HTTPException, NotImplemented,
+ "Cookie support not implemented yet");
}
if (mClientKeepAliveRequested)
diff --git a/lib/httpserver/S3Client.cpp b/lib/httpserver/S3Client.cpp
index afa04bb2..6124cc02 100644
--- a/lib/httpserver/S3Client.cpp
+++ b/lib/httpserver/S3Client.cpp
@@ -217,6 +217,7 @@ HTTPResponse S3Client::FinishAndSendRequest(HTTPRequest::Method Method,
}
else
{
+ BOX_TRACE("S3Client: " << mHostName << " ! " << ce.what());
throw;
}
}