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

Improve error messages format

This commit is contained in:
Pierre HUBERT 2020-03-31 16:28:35 +02:00
parent 7f82128c71
commit 92340bbc33
2 changed files with 8 additions and 2 deletions

View File

@ -175,7 +175,10 @@ export class UserWebSocketController {
// Try again to send again a response // Try again to send again a response
try { try {
handler.sendResponse("error", "Server error."); handler.sendResponse("error", {
code: 500,
message: "Server error"
});
} catch(e) { } catch(e) {
console.error(e); console.error(e);
} }

View File

@ -30,7 +30,10 @@ export class UserWebSocketRequestsHandler extends BaseRequestsHandler {
} }
public error(code: number, message: string): void { public error(code: number, message: string): void {
this.sendResponse("error", code + " - " + message); this.sendResponse("error", {
code: code,
message: message
});
throw new Error("An error occured while processing user WS request!"); throw new Error("An error occured while processing user WS request!");
} }