summaryrefslogtreecommitdiff
path: root/lib/httpserver/HTTPResponse.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-08-29 08:46:44 +0000
committerChris Wilson <chris+github@qwirx.com>2015-08-29 08:46:44 +0000
commit0b1405d0f7044a02bf26b1276c6ebb409d113521 (patch)
tree9f86cde7c83822b4e891550e38d02db63adb7ece /lib/httpserver/HTTPResponse.cpp
parentd7c6a65bc1a534dfb7e8264064bdf04c5862464d (diff)
Improve exception messages when reading an HTTPResponse
Diffstat (limited to 'lib/httpserver/HTTPResponse.cpp')
-rw-r--r--lib/httpserver/HTTPResponse.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/httpserver/HTTPResponse.cpp b/lib/httpserver/HTTPResponse.cpp
index a7ef42ce..c56f286f 100644
--- a/lib/httpserver/HTTPResponse.cpp
+++ b/lib/httpserver/HTTPResponse.cpp
@@ -341,22 +341,22 @@ void HTTPResponse::Receive(IOStream& rStream, int Timeout)
if(rGetLine.IsEOF())
{
// Connection terminated unexpectedly
- THROW_EXCEPTION(HTTPException, BadResponse)
+ THROW_EXCEPTION_MESSAGE(HTTPException, BadResponse,
+ "HTTP server closed the connection without sending a response");
}
std::string statusLine;
if(!rGetLine.GetLine(statusLine, false /* no preprocess */, Timeout))
{
// Timeout
- THROW_EXCEPTION(HTTPException, ResponseReadFailed)
+ THROW_EXCEPTION_MESSAGE(HTTPException, ResponseReadFailed,
+ "Failed to get a response from the HTTP server within the timeout");
}
- if (statusLine.substr(0, 7) != "HTTP/1." ||
- statusLine[8] != ' ')
+ if (statusLine.substr(0, 7) != "HTTP/1." || statusLine[8] != ' ')
{
- // Status line terminated unexpectedly
- BOX_ERROR("Bad response status line: " << statusLine);
- THROW_EXCEPTION(HTTPException, BadResponse)
+ THROW_EXCEPTION_MESSAGE(HTTPException, BadResponse,
+ "HTTP server sent an invalid HTTP status line: " << statusLine);
}
if (statusLine[5] == '1' && statusLine[7] == '1')