From 3eb7f3d4d9f89715e859d2785bb276e780682f67 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Tue, 27 Aug 2024 18:45:56 +0200 Subject: [PATCH] Remove unneeded code --- src/handlers/requestHandler.js | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/handlers/requestHandler.js b/src/handlers/requestHandler.js index f5bc881..3f9b95a 100644 --- a/src/handlers/requestHandler.js +++ b/src/handlers/requestHandler.js @@ -730,27 +730,10 @@ function requestHandler(req, res) { try { currentMiddleware(req, res, logFacilities, config, next); } catch (err) { - if (res.error) res.error(500, err); - else { - logFacilities.errmessage( - "There was an error while processing the request!", - ); - logFacilities.errmessage("Stack:"); - logFacilities.errmessage(err.stack); - res.writeHead(500, "Internal Server Error", { - Server: generateServerString(config.exposeServerVersion), - }); - res.end("Error while executing the request handler"); - } + res.error(500, err); } } else { - if (res.error) res.error(404); - else { - res.writeHead(404, "Not Found", { - Server: generateServerString(config.exposeServerVersion), - }); - res.end("Request handler missing"); - } + res.error(404); } };