Print exception to stderr

This commit is contained in:
blankie 2023-04-04 15:37:10 +07:00
parent e3ee4a445d
commit ba0fb29573
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 2 additions and 0 deletions

View File

@ -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");
}
});