From: Mikko Rasa Date: Sat, 21 Sep 2019 14:53:29 +0000 (+0300) Subject: Provide more information about exceptions in Http::Server X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=a82a89a937d798b5b376d6a58917557a92c56988;p=libs%2Fnet.git Provide more information about exceptions in Http::Server --- diff --git a/source/http/server.cpp b/source/http/server.cpp index f0474fd..7caa0f5 100644 --- a/source/http/server.cpp +++ b/source/http/server.cpp @@ -1,6 +1,8 @@ #include +#include #include #include +#include #include #include #include @@ -123,7 +125,8 @@ void Server::client_data_available(Client &cl) catch(const exception &e) { response = new Response(BAD_REQUEST); - response->add_content(e.what()); + response->add_content(format("An error occurred while parsing request headers:\ntype: %s\nwhat: %s", + Debug::demangle(typeid(e).name()), e.what())); } cl.in_buf = string(); } @@ -164,7 +167,8 @@ void Server::client_data_available(Client &cl) responses.erase(cl.response); cl.response = 0; response = new Response(INTERNAL_ERROR); - response->add_content(e.what()); + response->add_content(format("An error occurred while processing the request:\ntype: %s\nwhat: %s", + Debug::demangle(typeid(e).name()), e.what())); } }