fix: handle renderer crashes #115

This commit is contained in:
leukipp
2025-11-14 14:02:15 +01:00
parent 44a4fa9d2d
commit 5423239e62
2 changed files with 18 additions and 13 deletions
+12 -10
View File
@@ -126,7 +126,7 @@ const initApp = async () => {
}); });
// Register process exit events // Register process exit events
["SIGINT", "SIGTERM", "SIGQUIT", "exit"].forEach((signal) => { ["SIGINT", "SIGTERM", "SIGQUIT", "SIGTRAP", "exit"].forEach((signal) => {
process.on(signal, () => { process.on(signal, () => {
process.exitCode = 0; process.exitCode = 0;
APP.exiting = true; APP.exiting = true;
@@ -230,15 +230,17 @@ const initLog = async () => {
log.errorHandler.startCatching({ log.errorHandler.startCatching({
showDialog: false, showDialog: false,
onError({ error, versions }) { onError({ error, versions }) {
const build = { ...APP.build, ...versions }; if (!error?.message?.includes("Object has been destroyed")) {
const whoopsie = "💥 Whoopsie!"; const build = { ...APP.build, ...versions };
const section2 = `# Description\n- Hardware information?\n- How to reproduce?\n- Additional logs?\n`; const whoopsie = "💥 Whoopsie!";
const section3 = `# Error\n\`\`\`bash\n${new Date().toISOString()}: ${error.stack}\n\`\`\`\n`; const section2 = `# Description\n- Hardware information?\n- How to reproduce?\n- Additional logs?\n`;
const section4 = `# Application\n\`\`\`json\n${JSON.stringify(build, null, 2)}\n\`\`\`\n`; const section3 = `# Error\n\`\`\`bash\n${new Date().toISOString()}: ${error.stack}\n\`\`\`\n`;
const title = encodeURIComponent(`${whoopsie} - ${error}`); const section4 = `# Application\n\`\`\`json\n${JSON.stringify(build, null, 2)}\n\`\`\`\n`;
const body = encodeURIComponent(`${section2}\n${section3}\n${section4}`); const title = encodeURIComponent(`${whoopsie} - ${error}`);
console.error(`${whoopsie} -`, error, build); const body = encodeURIComponent(`${section2}\n${section3}\n${section4}`);
console.info(`🪲 Report issue --> ${APP.issues}/new?title=${title}&body=${body}`); console.error(`${whoopsie} -`, error, build);
console.info(`🪲 Report issue --> ${APP.issues}/new?title=${title}&body=${body}`);
}
app.quit(); app.quit();
}, },
}); });
+6 -3
View File
@@ -818,7 +818,7 @@ const windowEvents = async () => {
} }
toggleNavigation("OFF"); toggleNavigation("OFF");
} }
}, 1000); }, 1 * 1000);
}; };
/** /**
@@ -1220,8 +1220,11 @@ const appEvents = async () => {
// Handle crash events // Handle crash events
app.on("render-process-gone", (e, wc, details) => { app.on("render-process-gone", (e, wc, details) => {
const content = wc.getURL() || "Unknown"; const url = wc.getURL() || "Unknown";
console.error(`Render Process ${details.reason} (code ${details.exitCode}): ${content}`); if (!url.startsWith("data:")) {
console.error(`Render Process ${details.reason} (code ${details.exitCode}): ${url}`);
}
reloadView();
}); });
app.on("child-process-gone", (e, details) => { app.on("child-process-gone", (e, details) => {
const name = details.name || details.serviceName || "Unknown"; const name = details.name || details.serviceName || "Unknown";