Skip to content

Commit 7565378

Browse files
committed
Report and show a nice alert if the renderer crashes
1 parent ff3c335 commit 7565378

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,16 @@ if (!amMainInstance) {
205205
// Redirect all navigations & new windows to the system browser
206206
contents.on('will-navigate', handleNavigation);
207207
contents.on('new-window', handleNavigation);
208+
209+
contents.on('render-process-gone', (_event, details) => {
210+
if (details.reason === 'clean-exit') return;
211+
212+
reportError(`Renderer gone: ${details.reason}`);
213+
showErrorAlert(
214+
"UI crashed",
215+
"The HTTP Toolkit UI stopped unexpected.\n\nPlease file an issue at github.com/httptoolkit/httptoolkit."
216+
);
217+
});
208218
});
209219

210220
function handleNavigation(event: Electron.Event, navigationUrl: string) {

0 commit comments

Comments
 (0)