Skip to content

Commit d100ea7

Browse files
authored
Response with 500 on unhandled exceptions (#669)
Signed-off-by: Juan Cruz Viotti <[email protected]>
1 parent dd00098 commit d100ea7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/server/server.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,11 @@ static auto dispatch(const sourcemeta::core::URITemplateRouterView &router,
298298
"The server cannot satisfy the request content encoding");
299299
}
300300
} catch (const std::exception &error) {
301-
json_error(request, response, sourcemeta::one::STATUS_METHOD_NOT_ALLOWED,
301+
json_error(request, response, sourcemeta::one::STATUS_INTERNAL_SERVER_ERROR,
302302
"uncaught-error", error.what());
303+
} catch (...) {
304+
json_error(request, response, sourcemeta::one::STATUS_INTERNAL_SERVER_ERROR,
305+
"uncaught-error", "An unknown unexpected error occurred");
303306
}
304307
}
305308

0 commit comments

Comments
 (0)