From 2ef0844d342d4fa9992b8303201194a5ad6c3291 Mon Sep 17 00:00:00 2001 From: srgooglo Date: Fri, 6 May 2022 11:35:00 +0200 Subject: [PATCH] output an `serverError` when a request has a unhandled error --- src/server/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/server/index.js b/src/server/index.js index da019b8..53eb15f 100755 --- a/src/server/index.js +++ b/src/server/index.js @@ -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 })