RenaiApp/src/main/services/error.ts

13 lines
336 B
TypeScript

import { ipcServer } from '../controllers/api';
export function throwError(error: any, isFatal: boolean = false): void {
let errorInstance = error;
if (!(errorInstance instanceof Error)) {
errorInstance = new Error(error);
}
if (isFatal) {
throw errorInstance;
}
ipcServer.send(IpcChannels.ERROR, errorInstance);
}