Don't cache keytar until we know it works (#148567)

This commit is contained in:
Tyler James Leonhardt 2022-05-02 10:10:37 -07:00 committed by Tyler Leonhardt
parent 57dde38066
commit 708cb0c507
No known key found for this signature in database
GPG key ID: D9BFA0BA8AD9F6F7
2 changed files with 4 additions and 3 deletions

View file

@ -101,7 +101,7 @@ export abstract class BaseCredentialsMainService extends Disposable implements I
return;
} catch (e) {
error = e;
this.logService.warn('Error attempting to set a password: ', e);
this.logService.warn('Error attempting to set a password: ', e?.message ?? e);
attempts++;
await new Promise(resolve => setTimeout(resolve, 200));
}

View file

@ -36,9 +36,10 @@ export class CredentialsNativeMainService extends BaseCredentialsMainService {
return this._keytarCache;
}
this._keytarCache = await import('keytar');
const keytarCache = await import('keytar');
// Try using keytar to see if it throws or not.
await this._keytarCache.findCredentials('test-keytar-loads');
await keytarCache.findCredentials('test-keytar-loads');
this._keytarCache = keytarCache;
return this._keytarCache;
}