output an serverError when a request has a unhandled error

This commit is contained in:
srgooglo 2022-05-06 11:35:00 +02:00
parent c913e66c46
commit 2ef0844d34

View File

@ -297,6 +297,14 @@ class Server {
if (typeof this.params.onRouteError === "function") {
return this.params.onRouteError(req, res, error)
} else {
if (!global.silentOutputServerErrors) {
this.outputServerError({
message: "Unhandled route error:",
description: error.stack,
ref: [endpoint.method, endpoint.route].join("|"),
})
}
return res.status(500).json({
"error": error.message
})