Skip to content

Commit

Permalink
Respect auth cancellation (#4803)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexr00 authored May 10, 2023
1 parent a6b8d98 commit 1467a11
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/github/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ export class CredentialStore implements vscode.Disposable {
let retry: boolean = true;
let octokit: GitHub | undefined = undefined;
const sessionOptions: vscode.AuthenticationGetSessionOptions = { createIfNone: true };
let isCanceled: boolean = false;
while (retry) {
try {
await this.initialize(authProviderId, sessionOptions);
Expand All @@ -261,9 +262,12 @@ export class CredentialStore implements vscode.Disposable {
if (e instanceof Error && e.stack) {
Logger.error(e.stack);
}
if (e.message === 'Cancelled') {
isCanceled = true;
}
}
octokit = this.getHub(authProviderId);
if (octokit) {
if (octokit || isCanceled) {
retry = false;
} else {
retry = (await vscode.window.showErrorMessage(errorPrefix, TRY_AGAIN, CANCEL)) === TRY_AGAIN;
Expand Down

0 comments on commit 1467a11

Please sign in to comment.