Skip to content

Commit 91a5779

Browse files
committed
fix: improve app initialization error handling
- Add error dialog to notify users when initialization fails - Log detailed error information for debugging - Ensure app exits cleanly on initialization failure - Prevent app from running in inconsistent state after init errors This fixes the issue where app.whenReady().catch(console.log) would silently swallow initialization errors, leaving the app running in a zombie state with no user feedback. Changes: - Import dialog from electron - Replace console.log with proper error handling - Show user-friendly error dialog with error details - Log full error stack trace for debugging - Call app.quit() to exit cleanly Severity: Critical (8-9/10) Impact: Prevents app from running in inconsistent state, improves UX
1 parent de90499 commit 91a5779

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

apps/ui-tars/src/main/main.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
BrowserView,
99
BrowserWindow,
1010
desktopCapturer,
11+
dialog,
1112
ipcMain,
1213
session,
1314
WebContentsView,
@@ -231,4 +232,17 @@ app
231232
logger.info('app.whenReady end');
232233
})
233234

234-
.catch(console.log);
235+
.catch((error) => {
236+
// Log detailed error information
237+
logger.error('Failed to initialize app:', error);
238+
logger.error('Error stack:', error.stack);
239+
240+
// Show user-friendly error dialog
241+
dialog.showErrorBox(
242+
'UI-TARS Initialization Failed',
243+
`Failed to start UI-TARS:\n\n${error.message}\n\nPlease check the logs for details.\n\nThe application will now exit.`,
244+
);
245+
246+
// Exit the application safely
247+
app.quit();
248+
});

0 commit comments

Comments
 (0)