Skip to content

Commit

Permalink
Improve Electron process crash error message
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Jul 24, 2024
1 parent 4db9068 commit 609a453
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@
"context": "type will become something like 'NW.js' or 'Electron'. Do not translate 'macOS'."
},
"application-linux64": {
"string": "{type} Linux application (64-bit only)",
"string": "{type} Linux application (64-bit)",
"context": "type will become something like 'NW.js' or 'Electron'. Do not translate 'Linux'."
},
"application-linux-arm32": {
Expand Down
15 changes: 13 additions & 2 deletions src/packager/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -663,20 +663,31 @@ const openLink = (url) => {
}
};
const createProcessCrashMessage = (details) => {
let message = details.type ? details.type + ' child process' : 'Renderer process';
message += ' crashed: ' + details.reason + ' (' + details.exitCode + ')\\n\\n';
if (process.arch === 'ia32') {
message += 'Usually this means the project was too big for the 32-bit Electron environment or your computer is out of memory. Ask the creator to use the 64-bit environment instead.';
} else {
message += 'Usually this means your computer is out of memory.';
}
return message;
};
app.on('render-process-gone', (event, webContents, details) => {
const window = BrowserWindow.fromWebContents(webContents);
dialog.showMessageBoxSync(window, {
type: 'error',
title: 'Error',
message: 'Renderer process crashed: ' + details.reason + ' (' + details.exitCode + ')'
message: createProcessCrashMessage(details)
});
});
app.on('child-process-gone', (event, details) => {
dialog.showMessageBoxSync({
type: 'error',
title: 'Error',
message: details.type + ' child process crashed: ' + details.reason + ' (' + details.exitCode + ')'
message: createProcessCrashMessage(details)
});
});
Expand Down

0 comments on commit 609a453

Please sign in to comment.