]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
webserver.cc: try to pass exception text with 500 errors 14706/head
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 13 Sep 2024 13:46:06 +0000 (15:46 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Wed, 25 Sep 2024 09:36:33 +0000 (11:36 +0200)
fixes #14637 -if- the client sends `Accept: application/json`

(cherry picked from commit 27ff9f415d5c1431dd78486e691a008f969f5843)

pdns/webserver.cc

index 754484558af6b0dbe42ccfca98405419834a8a02..a6685ae25157403ed1cce4f26eec6376f61996e2 100644 (file)
@@ -301,12 +301,12 @@ void WebServer::handleRequest(HttpRequest& req, HttpResponse& resp) const
     catch(PDNSException &e) {
       SLOG(g_log<<Logger::Error<<req.logprefix<<"HTTP ISE for \""<< req.url.path << "\": Exception: " << e.reason << endl,
            log->error(Logr::Error, e.reason, msg, "exception", Logging::Loggable("PDNSException")));
-      throw HttpInternalServerErrorException();
+      throw HttpInternalServerErrorException(e.reason);
     }
     catch(std::exception &e) {
       SLOG(g_log<<Logger::Error<<req.logprefix<<"HTTP ISE for \""<< req.url.path << "\": STL Exception: " << e.what() << endl,
            log->error(Logr::Error, e.what(), msg, "exception", Logging::Loggable("std::exception")));
-      throw HttpInternalServerErrorException();
+      throw HttpInternalServerErrorException(e.what());
     }
     catch(...) {
       SLOG(g_log<<Logger::Error<<req.logprefix<<"HTTP ISE for \""<< req.url.path << "\": Unknown Exception" << endl,