1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-12-28 14:38:52 +00:00

Do not throw error in main loop

This commit is contained in:
Pierre HUBERT 2019-11-30 12:18:45 +01:00
parent 3db123cd1e
commit bd19411a48
2 changed files with 3 additions and 2 deletions

View File

@ -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 +")");
}

View File

@ -46,7 +46,7 @@ async function init() {
} catch(e) {
console.error(e);
handler.error(500, "Internal error.");
handler.error(500, "Internal error.", false);
}
};