diff --git a/src/preload.ts b/src/preload.ts index bd013ec..c500d92 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -1,5 +1,10 @@ import { contextBridge, ipcRenderer } from "electron"; +/* Log errors */ +ipcRenderer.on("error", (_, err) => { + console.error(err); +}); + /* Context bridge */ contextBridge.exposeInMainWorld("internals", { argv: () => ipcRenderer.invoke("argv"), diff --git a/src/utils/misc.ts b/src/utils/misc.ts index ca7a75c..b4552b5 100644 --- a/src/utils/misc.ts +++ b/src/utils/misc.ts @@ -18,9 +18,9 @@ export const getVideoDuration = (file: string) => { }; /** Print an error to the console and open the dev tool panel */ -export const printAndDevTool = (win: BrowserWindow, error: string) => { - console.error(error); +export const printAndDevTool = (win: BrowserWindow, err: string) => { win.webContents.openDevTools(); + win.webContents.send("error", err); }; /** Run a command asynchronously */