mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 21:39:22 +00:00
Do not throw error in main loop
This commit is contained in:
parent
3db123cd1e
commit
bd19411a48
@ -218,7 +218,7 @@ export class RequestHandler {
|
|||||||
* @param code HTTP Status code
|
* @param code HTTP Status code
|
||||||
* @param message The message to send
|
* @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)
|
if(this.responseSent)
|
||||||
return;
|
return;
|
||||||
@ -232,6 +232,7 @@ export class RequestHandler {
|
|||||||
|
|
||||||
this.responseSent = true;
|
this.responseSent = true;
|
||||||
|
|
||||||
|
if(should_throw)
|
||||||
throw Error("Could not complete request! ("+ message +")");
|
throw Error("Could not complete request! ("+ message +")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ async function init() {
|
|||||||
|
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
handler.error(500, "Internal error.");
|
handler.error(500, "Internal error.", false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user