mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-28 02:23:53 +02:00
feat(desktop): handle startup failure and renderer load errors
This commit is contained in:
parent
9434965803
commit
36924bbd65
1 changed files with 13 additions and 1 deletions
|
|
@ -128,6 +128,12 @@ function createWindow() {
|
|||
callback({ redirectURL: rewritten });
|
||||
});
|
||||
|
||||
mainWindow.webContents.on('did-fail-load', (_event, errorCode, errorDescription, validatedURL) => {
|
||||
console.error(`Failed to load ${validatedURL}: ${errorDescription} (${errorCode})`);
|
||||
if (errorCode === -3) return; // ERR_ABORTED — normal during redirects
|
||||
showErrorDialog('Page failed to load', new Error(`${errorDescription} (${errorCode})\n${validatedURL}`));
|
||||
});
|
||||
|
||||
if (isDev) {
|
||||
mainWindow.webContents.openDevTools();
|
||||
}
|
||||
|
|
@ -199,7 +205,13 @@ if (process.defaultApp) {
|
|||
|
||||
// App lifecycle
|
||||
app.whenReady().then(async () => {
|
||||
await startNextServer();
|
||||
try {
|
||||
await startNextServer();
|
||||
} catch (error) {
|
||||
showErrorDialog('Failed to start SurfSense', error);
|
||||
setTimeout(() => app.quit(), 0);
|
||||
return;
|
||||
}
|
||||
createWindow();
|
||||
|
||||
// If a deep link was received before the window was ready, handle it now
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue