Skip to content

Commit ba4f8b3

Browse files
committed
more granular and don't do anything before the app is ready
1 parent 9401c55 commit ba4f8b3

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

packages/compass/src/main/application.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ class CompassApplication {
106106
safeStorage.setUsePlainTextEncryption(true);
107107
}
108108

109+
process.stdout.write('before first app.whenReady\n');
110+
await app.whenReady();
111+
process.stdout.write('after first app.whenReady\n');
112+
109113
process.stdout.write('before setupPreferencesAndUser\n');
110114
const { preferences } = await setupPreferencesAndUser(
111115
globalPreferences,
@@ -194,7 +198,12 @@ class CompassApplication {
194198
}
195199

196200
private static async setupCompassAuthService() {
197-
await CompassAuthService.init(this.preferences, this.httpClient);
201+
try {
202+
await CompassAuthService.init(this.preferences, this.httpClient);
203+
} catch (err: any) {
204+
process.stdout.write('Got CompassAuthService.init error\n');
205+
throw err;
206+
}
198207
this.addExitHandler(() => {
199208
return CompassAuthService.onExit();
200209
});
@@ -310,14 +319,18 @@ class CompassApplication {
310319
logContext: string
311320
): Promise<() => void> {
312321
const onChange = async (value: string) => {
322+
process.stdout.write('setupProxySupport onChange\n');
313323
try {
314324
const proxyOptions = proxyPreferenceToProxyOptions(value);
315325
await app.whenReady();
316326

327+
process.stdout.write('after setupProxySupport app.whenReady\n');
328+
317329
try {
318330
const electronProxyConfig =
319331
translateToElectronProxyConfig(proxyOptions);
320332
await target.setProxy(electronProxyConfig);
333+
process.stdout.write('after setupProxySupport target.setProxy\n');
321334
} catch (err) {
322335
const headline = String(
323336
err && typeof err === 'object' && 'message' in err
@@ -335,6 +348,7 @@ class CompassApplication {
335348
}
336349
);
337350
await target.setProxy({});
351+
process.stdout.write('after setupProxySupport target.setProxy({})\n');
338352
}
339353

340354
const agent = createAgent(proxyOptions);
@@ -361,6 +375,9 @@ class CompassApplication {
361375
),
362376
}
363377
);
378+
process.stdout.write(
379+
'after setupProxySupport Unable to set proxy configuration\n'
380+
);
364381
}
365382
};
366383
const unsubscribe = this.preferences.onPreferenceValueChanged(

0 commit comments

Comments
 (0)