From 5423239e6259072755429505e84c2dd6b1e8f1e5 Mon Sep 17 00:00:00 2001 From: leukipp Date: Fri, 14 Nov 2025 14:02:15 +0100 Subject: [PATCH] fix: handle renderer crashes #115 --- index.js | 22 ++++++++++++---------- js/webview.js | 9 ++++++--- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/index.js b/index.js index 44e0894..a3263f3 100644 --- a/index.js +++ b/index.js @@ -126,7 +126,7 @@ const initApp = async () => { }); // Register process exit events - ["SIGINT", "SIGTERM", "SIGQUIT", "exit"].forEach((signal) => { + ["SIGINT", "SIGTERM", "SIGQUIT", "SIGTRAP", "exit"].forEach((signal) => { process.on(signal, () => { process.exitCode = 0; APP.exiting = true; @@ -230,15 +230,17 @@ const initLog = async () => { log.errorHandler.startCatching({ showDialog: false, onError({ error, versions }) { - const build = { ...APP.build, ...versions }; - const whoopsie = "💥 Whoopsie!"; - const section2 = `# Description\n- Hardware information?\n- How to reproduce?\n- Additional logs?\n`; - const section3 = `# Error\n\`\`\`bash\n${new Date().toISOString()}: ${error.stack}\n\`\`\`\n`; - const section4 = `# Application\n\`\`\`json\n${JSON.stringify(build, null, 2)}\n\`\`\`\n`; - const title = encodeURIComponent(`${whoopsie} - ${error}`); - const body = encodeURIComponent(`${section2}\n${section3}\n${section4}`); - console.error(`${whoopsie} -`, error, build); - console.info(`🪲 Report issue --> ${APP.issues}/new?title=${title}&body=${body}`); + if (!error?.message?.includes("Object has been destroyed")) { + const build = { ...APP.build, ...versions }; + const whoopsie = "💥 Whoopsie!"; + const section2 = `# Description\n- Hardware information?\n- How to reproduce?\n- Additional logs?\n`; + const section3 = `# Error\n\`\`\`bash\n${new Date().toISOString()}: ${error.stack}\n\`\`\`\n`; + const section4 = `# Application\n\`\`\`json\n${JSON.stringify(build, null, 2)}\n\`\`\`\n`; + const title = encodeURIComponent(`${whoopsie} - ${error}`); + const body = encodeURIComponent(`${section2}\n${section3}\n${section4}`); + console.error(`${whoopsie} -`, error, build); + console.info(`🪲 Report issue --> ${APP.issues}/new?title=${title}&body=${body}`); + } app.quit(); }, }); diff --git a/js/webview.js b/js/webview.js index af5e7db..91c642a 100644 --- a/js/webview.js +++ b/js/webview.js @@ -818,7 +818,7 @@ const windowEvents = async () => { } toggleNavigation("OFF"); } - }, 1000); + }, 1 * 1000); }; /** @@ -1220,8 +1220,11 @@ const appEvents = async () => { // Handle crash events app.on("render-process-gone", (e, wc, details) => { - const content = wc.getURL() || "Unknown"; - console.error(`Render Process ${details.reason} (code ${details.exitCode}): ${content}`); + const url = wc.getURL() || "Unknown"; + if (!url.startsWith("data:")) { + console.error(`Render Process ${details.reason} (code ${details.exitCode}): ${url}`); + } + reloadView(); }); app.on("child-process-gone", (e, details) => { const name = details.name || details.serviceName || "Unknown";