소스 검색

Fixes #1897 avoid messages on 500 errors

Hides unexpected GitHub errors for now
Refs #1893
main
Eric Amodio 2 년 전
부모
커밋
948405e282
2개의 변경된 파일21개의 추가작업 그리고 12개의 파일을 삭제
  1. +6
    -0
      CHANGELOG.md
  2. +15
    -12
      src/plus/github/github.ts

+ 6
- 0
CHANGELOG.md 파일 보기

@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Fixed
- Fixes [#1897](https://github.com/gitkraken/vscode-gitlens/issues/1897) - Repeated GitHub errors when offline
## [12.0.2] - 2022-03-09
### Added

+ 15
- 12
src/plus/github/github.ts 파일 보기

@ -1764,11 +1764,13 @@ export class GitHubApi implements Disposable {
}
}
void window.showErrorMessage(`GitHub request failed: ${ex.errors?.[0]?.message ?? ex.message}`, 'OK');
if (Logger.isDebugging) {
void window.showErrorMessage(`GitHub request failed: ${ex.errors?.[0]?.message ?? ex.message}`);
}
} else if (ex instanceof RequestError) {
this.handleRequestError(ex, token);
} else {
void window.showErrorMessage(`GitHub request failed: ${ex.message}`, 'OK');
} else if (Logger.isDebugging) {
void window.showErrorMessage(`GitHub request failed: ${ex.message}`);
}
throw ex;
@ -1785,8 +1787,8 @@ export class GitHubApi implements Disposable {
} catch (ex) {
if (ex instanceof RequestError) {
this.handleRequestError(ex, token);
} else {
void window.showErrorMessage(`GitHub request failed: ${ex.message}`, 'OK');
} else if (Logger.isDebugging) {
void window.showErrorMessage(`GitHub request failed: ${ex.message}`);
}
throw ex;
@ -1824,11 +1826,11 @@ export class GitHubApi implements Disposable {
'OK',
);
}
break;
return;
case 502: // Bad Gateway
// GitHub seems to return this status code for timeouts
if (ex.message.includes('timeout')) {
void window.showErrorMessage('GitHub request timed out', 'OK');
void window.showErrorMessage('GitHub request timed out');
return;
}
break;
@ -1837,10 +1839,11 @@ export class GitHubApi implements Disposable {
break;
}
void window.showErrorMessage(
`GitHub request failed: ${(ex.response as any)?.errors?.[0]?.message ?? ex.message}`,
'OK',
);
if (Logger.isDebugging) {
void window.showErrorMessage(
`GitHub request failed: ${(ex.response as any)?.errors?.[0]?.message ?? ex.message}`,
);
}
}
private handleException<T>(ex: unknown | Error, cc: LogCorrelationContext | undefined, defaultValue: T): T {
@ -1869,7 +1872,7 @@ export class GitHubApi implements Disposable {
this._onDidReauthenticate.fire();
}
} else {
void window.showErrorMessage(ex.message, 'OK');
void window.showErrorMessage(ex.message);
}
}
}

불러오는 중...
취소
저장