fix logging

This commit is contained in:
Mylloon 2023-08-04 20:00:31 +02:00
parent 3875d3cefe
commit 542136dc46
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 7 additions and 2 deletions

View file

@ -1,5 +1,10 @@
import { contextBridge, ipcRenderer } from "electron"; import { contextBridge, ipcRenderer } from "electron";
/* Log errors */
ipcRenderer.on("error", (_, err) => {
console.error(err);
});
/* Context bridge */ /* Context bridge */
contextBridge.exposeInMainWorld("internals", { contextBridge.exposeInMainWorld("internals", {
argv: () => ipcRenderer.invoke("argv"), argv: () => ipcRenderer.invoke("argv"),

View file

@ -18,9 +18,9 @@ export const getVideoDuration = (file: string) => {
}; };
/** Print an error to the console and open the dev tool panel */ /** Print an error to the console and open the dev tool panel */
export const printAndDevTool = (win: BrowserWindow, error: string) => { export const printAndDevTool = (win: BrowserWindow, err: string) => {
console.error(error);
win.webContents.openDevTools(); win.webContents.openDevTools();
win.webContents.send("error", err);
}; };
/** Run a command asynchronously */ /** Run a command asynchronously */