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);
}
