From ba4f8b329c3bc7b3e1c8653504e806257ec48455 Mon Sep 17 00:00:00 2001 From: Le Roux Bodenstein Date: Fri, 27 Dec 2024 14:00:26 +0000 Subject: [PATCH] more granular and don't do anything before the app is ready --- packages/compass/src/main/application.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/compass/src/main/application.ts b/packages/compass/src/main/application.ts index 5d6b64ea106..f341aea4f9a 100644 --- a/packages/compass/src/main/application.ts +++ b/packages/compass/src/main/application.ts @@ -106,6 +106,10 @@ class CompassApplication { safeStorage.setUsePlainTextEncryption(true); } + process.stdout.write('before first app.whenReady\n'); + await app.whenReady(); + process.stdout.write('after first app.whenReady\n'); + process.stdout.write('before setupPreferencesAndUser\n'); const { preferences } = await setupPreferencesAndUser( globalPreferences, @@ -194,7 +198,12 @@ class CompassApplication { } private static async setupCompassAuthService() { - await CompassAuthService.init(this.preferences, this.httpClient); + try { + await CompassAuthService.init(this.preferences, this.httpClient); + } catch (err: any) { + process.stdout.write('Got CompassAuthService.init error\n'); + throw err; + } this.addExitHandler(() => { return CompassAuthService.onExit(); }); @@ -310,14 +319,18 @@ class CompassApplication { logContext: string ): Promise<() => void> { const onChange = async (value: string) => { + process.stdout.write('setupProxySupport onChange\n'); try { const proxyOptions = proxyPreferenceToProxyOptions(value); await app.whenReady(); + process.stdout.write('after setupProxySupport app.whenReady\n'); + try { const electronProxyConfig = translateToElectronProxyConfig(proxyOptions); await target.setProxy(electronProxyConfig); + process.stdout.write('after setupProxySupport target.setProxy\n'); } catch (err) { const headline = String( err && typeof err === 'object' && 'message' in err @@ -335,6 +348,7 @@ class CompassApplication { } ); await target.setProxy({}); + process.stdout.write('after setupProxySupport target.setProxy({})\n'); } const agent = createAgent(proxyOptions); @@ -361,6 +375,9 @@ class CompassApplication { ), } ); + process.stdout.write( + 'after setupProxySupport Unable to set proxy configuration\n' + ); } }; const unsubscribe = this.preferences.onPreferenceValueChanged(