@@ -46,28 +46,39 @@ let mainWindow: BrowserWindow | null = null;
4646
4747// App ready event
4848app . whenReady ( ) . then ( async ( ) => {
49- // Initialize all services
50- await initializeServices ( ) ;
49+ try {
50+ // Initialize all services
51+ await initializeServices ( ) ;
5152
52- // Register all IPC handlers
53- registerIPCHandlers ( ( ) => mainWindow ) ;
53+ // Register all IPC handlers
54+ await registerIPCHandlers ( ( ) => mainWindow ) ;
5455
55- // Create main window
56- mainWindow = createMainWindow ( ) ;
56+ // Create main window
57+ mainWindow = createMainWindow ( ) ;
5758
58- // Track app open (fire and forget, don't block UI)
59- analyticsService . trackAppOpen ( ) . catch ( ( ) => { } ) ;
59+ // Track app open (fire and forget, don't block UI)
60+ analyticsService . trackAppOpen ( ) . catch ( ( ) => { } ) ;
6061
61- // Create application menu
62- createApplicationMenu ( mainWindow ) ;
62+ // Create application menu
63+ createApplicationMenu ( mainWindow ) ;
6364
64- // Register main window with services
65- deepLinkService . setMainWindow ( mainWindow ) ;
66- oauthCallbackServer . setMainWindow ( mainWindow ) ;
65+ // Register main window with services
66+ deepLinkService . setMainWindow ( mainWindow ) ;
67+ oauthCallbackServer . setMainWindow ( mainWindow ) ;
6768
68- // Register app event handlers
69- registerAppEvents ( ( ) => mainWindow ) ;
69+ // Register app event handlers
70+ registerAppEvents ( ( ) => mainWindow ) ;
7071
71- // Setup deep link handling (Windows/Linux)
72- setupDeepLinkHandling ( ) ;
72+ // Setup deep link handling (Windows/Linux)
73+ setupDeepLinkHandling ( ) ;
74+ } catch ( error ) {
75+ console . error ( 'Fatal error during app initialization:' , error ) ;
76+ // Show error dialog and quit
77+ const { dialog } = await import ( 'electron' ) ;
78+ dialog . showErrorBox (
79+ 'Initialization Error' ,
80+ `Failed to start the application:\n\n${ error instanceof Error ? error . message : String ( error ) } `
81+ ) ;
82+ app . quit ( ) ;
83+ }
7384} ) ;
0 commit comments