]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
webserver.cc: try to pass exception text with 500 errors 14670/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>
Fri, 13 Sep 2024 13:46:15 +0000 (15:46 +0200)
fixes #14637 -if- the client sends `Accept: application/json`

pdns/webserver.cc

index 8a257c66fe3384c771c2369c42f5783b96f5927b..58fb65c0ff1651ceea224a20e9a90c498044fab6 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,