mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 13:29:22 +00:00
Improve errors handling
This commit is contained in:
parent
92340bbc33
commit
821c8211cc
@ -172,8 +172,10 @@ export class UserWebSocketController {
|
|||||||
await route.handler(handler);
|
await route.handler(handler);
|
||||||
|
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
console.error(e);
|
||||||
|
|
||||||
// Try again to send again a response
|
// Try to send a server error response
|
||||||
|
if(!handler.isResponseSent) {
|
||||||
try {
|
try {
|
||||||
handler.sendResponse("error", {
|
handler.sendResponse("error", {
|
||||||
code: 500,
|
code: 500,
|
||||||
@ -182,6 +184,7 @@ export class UserWebSocketController {
|
|||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -16,6 +16,10 @@ export class UserWebSocketRequestsHandler extends BaseRequestsHandler {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get isResponseSent() : boolean {
|
||||||
|
return this.sentResponse;
|
||||||
|
}
|
||||||
|
|
||||||
protected get userID(): number {
|
protected get userID(): number {
|
||||||
return this.wsClient.userID;
|
return this.wsClient.userID;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user