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) => {
|
const answer = (id: string, data: any, err?: Error | string) => {
|
||||||
if (error) Logging.error(error as any);
|
let error = false;
|
||||||
|
if (err) {
|
||||||
|
if (err instanceof Error) {
|
||||||
|
data = err.message;
|
||||||
|
} else {
|
||||||
|
data = err;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
socket.send(
|
socket.send(
|
||||||
JSON.stringify({ ns: "message", data: { id, error, data } })
|
JSON.stringify({ ns: "message", data: { id, error, data } })
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user