This commit is contained in:
parent
ff468410ad
commit
24e46922c9
@ -72,8 +72,17 @@ export class WebsocketConnectionManager {
|
||||
}
|
||||
}
|
||||
|
||||
const answer = (id: string, data: any, error: boolean = false) => {
|
||||
if (error) Logging.error(error as any);
|
||||
const answer = (id: string, data: any, err?: Error | string) => {
|
||||
let error = false;
|
||||
if (err) {
|
||||
if (err instanceof Error) {
|
||||
data = err.message;
|
||||
} else {
|
||||
data = err;
|
||||
}
|
||||
|
||||
error = true;
|
||||
}
|
||||
socket.send(
|
||||
JSON.stringify({ ns: "message", data: { id, error, data } })
|
||||
);
|
||||
|
Reference in New Issue
Block a user