Browse Source

Fixes #2318 avoids sign out in more cases

main
Eric Amodio 2 years ago
parent
commit
47798cc154
2 changed files with 25 additions and 10 deletions
  1. +2
    -0
      CHANGELOG.md
  2. +23
    -10
      src/plus/subscription/subscriptionService.ts

+ 2
- 0
CHANGELOG.md View File

@ -24,10 +24,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Holding the `ctrl` key with a commit row selected will highlight rows for that commit's branch
### Changed
- In the _Commit Graph_, increases the time to highlight associated rows when hovering over a branch to 1s
### Fixed
- Fixes [#2318](https://github.com/gitkraken/vscode-gitlens/issues/2318) - GitLens need to login again after VS Code insiders upgrade every day
- Fixes [#2377](https://github.com/gitkraken/vscode-gitlens/issues/2377) - Missing Azure Devops Icon
- Fixes [#2380](https://github.com/gitkraken/vscode-gitlens/issues/2380) - Autolink fails with curly braces
- Fixes [#2381](https://github.com/gitkraken/vscode-gitlens/issues/2381) - can't use scrollbar in 'Commit Graph' view

+ 23
- 10
src/plus/subscription/subscriptionService.ts View File

@ -754,16 +754,29 @@ export class SubscriptionService implements Disposable {
Logger.error(ex, scope);
debugger;
this.container.telemetry.sendEvent('account/validation/failed', {
'account.id': session.account.id,
exception: String(ex),
code: ex.original?.code,
statusCode: ex.statusCode,
});
Logger.debug(scope, `Account validation failed (${ex.statusCode ?? ex.original?.code})`);
if (ex instanceof AccountValidationError) {
const name = session.account.label;
// if (
// (ex.statusCode != null && ex.statusCode < 500) ||
// (ex.statusCode == null && (ex.original as any)?.code !== 'ENOTFOUND')
// ) {
if (
(ex.statusCode != null && ex.statusCode < 500) ||
(ex.statusCode == null && (ex.original as any)?.code !== 'ENOTFOUND')
(ex.original as any)?.code !== 'ENOTFOUND' &&
ex.statusCode != null &&
ex.statusCode < 500 &&
ex.statusCode >= 400
) {
session = null;
Logger.debug(scope, `Account validation failed (${ex.statusCode ?? (ex.original as any)?.code})`);
await this.logoutCore();
if (createIfNeeded) {
@ -785,12 +798,12 @@ export class SubscriptionService implements Disposable {
} else {
session = session ?? null;
if ((ex.original as any)?.code !== 'ENOTFOUND') {
void window.showErrorMessage(
`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}`,
'OK',
);
}
// if ((ex.original as any)?.code !== 'ENOTFOUND') {
// void window.showErrorMessage(
// `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}`,
// 'OK',
// );
// }
}
}
}

Loading…
Cancel
Save