summaryrefslogtreecommitdiff
path: root/zen/http.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zen/http.cpp')
-rw-r--r--zen/http.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/zen/http.cpp b/zen/http.cpp
index 8cdcd65c..fcf69fb3 100644
--- a/zen/http.cpp
+++ b/zen/http.cpp
@@ -265,7 +265,17 @@ std::unique_ptr<HttpInputStream::Impl> sendHttpRequestImpl(const Zstring& url,
else
{
if (httpStatus != 200) //HTTP_STATUS_OK
- throw SysError(formatHttpError(httpStatus)); //e.g. "HTTP status 404: Not found."
+ {
+#if 0 //beneficial to add error details?
+ std::wstring errorDetails;
+ try
+ {
+ errorDetails = utfTo<std::wstring>(HttpInputStream(std::move(response)).readAll(nullptr /*notifyUnbufferedIO*/)); //throw SysError
+ }
+ catch (const SysError& e) { errorDetails = e.toString(); }
+#endif
+ throw SysError(formatHttpError(httpStatus) /*+ L' ' + errorDetails*/); //e.g. "HTTP status 404: Not found."
+ }
return response;
}
bgstack15