mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-11-04 11:34:04 +00:00 
			
		
		
		
	Do not throw error in main loop
This commit is contained in:
		@@ -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 +")");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ async function init() {
 | 
			
		||||
 | 
			
		||||
			} catch(e) {
 | 
			
		||||
				console.error(e);
 | 
			
		||||
				handler.error(500, "Internal error.");
 | 
			
		||||
				handler.error(500, "Internal error.", false);
 | 
			
		||||
			}
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user