From ba0fb295738717b90e8671c2a42c3486c7b2b699 Mon Sep 17 00:00:00 2001 From: blankie Date: Tue, 4 Apr 2023 15:37:10 +0700 Subject: [PATCH] Print exception to stderr --- main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.cpp b/main.cpp index 23140cb..24114b6 100644 --- a/main.cpp +++ b/main.cpp @@ -62,8 +62,10 @@ int main(int argc, char** argv) { try { std::rethrow_exception(ep); } catch (const std::exception& e) { + fprintf(stderr, "Exception thrown on %s: %s\n", req.path.c_str(), e.what()); serve_error(req, res, config, "500: Internal server error", std::nullopt, e.what()); } catch (...) { + fprintf(stderr, "Exception thrown on %s: Unknown exception\n", req.path.c_str()); serve_error(req, res, config, "500: Internal server error", std::nullopt, "Unknown exception"); } });