From bd19411a48f22e03115b7a415c63b3105991480f Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 30 Nov 2019 12:18:45 +0100 Subject: [PATCH] Do not throw error in main loop --- src/entities/RequestHandler.ts | 3 ++- src/main.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/entities/RequestHandler.ts b/src/entities/RequestHandler.ts index b19a861..a04d564 100644 --- a/src/entities/RequestHandler.ts +++ b/src/entities/RequestHandler.ts @@ -218,7 +218,7 @@ export class RequestHandler { * @param code HTTP Status code * @param message The message to send */ - public error(code : number, message : string) { + public error(code : number, message : string, should_throw: boolean = true) { if(this.responseSent) return; @@ -232,6 +232,7 @@ export class RequestHandler { this.responseSent = true; + if(should_throw) throw Error("Could not complete request! ("+ message +")"); } diff --git a/src/main.ts b/src/main.ts index 659f2cd..d192232 100644 --- a/src/main.ts +++ b/src/main.ts @@ -46,7 +46,7 @@ async function init() { } catch(e) { console.error(e); - handler.error(500, "Internal error."); + handler.error(500, "Internal error.", false); } };