Skip to content

Commit 7b4fc94

Browse files
committed
Adds a bit better handling of service issues
Refs: #1911
1 parent b1befa9 commit 7b4fc94

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

src/plus/subscription/subscriptionService.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,12 +690,30 @@ export class SubscriptionService implements Disposable {
690690

691691
const name = session.account.label;
692692
session = null;
693-
if (ex instanceof AccountValidationError) {
694-
await this.logout();
695693

696-
if (createIfNeeded) {
694+
if (ex instanceof AccountValidationError) {
695+
if (ex.statusCode == null || ex.statusCode < 500) {
696+
await this.logout();
697+
698+
if (createIfNeeded) {
699+
const unauthorized = ex.statusCode === 401;
700+
queueMicrotask(async () => {
701+
const confirm: MessageItem = { title: 'Retry Sign In' };
702+
const result = await window.showErrorMessage(
703+
`Unable to sign in to your (${name}) GitLens+ account. Please try again. If this issue persists, please contact support.${
704+
unauthorized ? '' : ` Error=${ex.message}`
705+
}`,
706+
confirm,
707+
);
708+
709+
if (result === confirm) {
710+
void this.loginOrSignUp();
711+
}
712+
});
713+
}
714+
} else {
697715
void window.showErrorMessage(
698-
`Unable to sign in to your GitLens+ account. Please try again. If this issue persists, please contact support. Account=${name} Error=${ex.message}`,
716+
`Unable to sign in to your (${name}) GitLens+ account right now. Please try again in a few minutes. If this issue persists, please contact support. Error=${ex.message}`,
699717
'OK',
700718
);
701719
}

0 commit comments

Comments
 (0)