Skip to content

Commit 171242c

Browse files
Better handling of github 503 errors
1 parent 6d3d45b commit 171242c

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/plus/focus/focus.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,13 @@ export class FocusCommand extends QuickCommand<State> {
467467
function getItemsAndPlaceholder() {
468468
if (context.result.error != null) {
469469
return {
470-
placeholder: `Unable to load items (${String(context.result.error)})`,
470+
placeholder: `Unable to load items (${
471+
context.result.error.name === 'HttpError' &&
472+
'status' in context.result.error &&
473+
typeof context.result.error.status === 'number'
474+
? `${context.result.error.status}: ${String(context.result.error)}`
475+
: String(context.result.error)
476+
})`,
471477
items: [createDirectiveQuickPickItem(Directive.Cancel, undefined, { label: 'OK' })],
472478
};
473479
}

src/plus/integrations/providers/github/github.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2709,6 +2709,17 @@ export class GitHubApi implements Disposable {
27092709
return;
27102710
}
27112711
break;
2712+
case 503: // Service Unavailable
2713+
Logger.error(ex, scope);
2714+
provider?.trackRequestException();
2715+
void showIntegrationRequestFailed500WarningMessage(
2716+
`${provider?.name ?? 'GitHub'} failed to respond and might be experiencing issues.${
2717+
provider == null || provider.id === 'github'
2718+
? ' Please visit the [GitHub status page](https://githubstatus.com) for more information.'
2719+
: ''
2720+
}`,
2721+
);
2722+
return;
27122723
default:
27132724
if (ex.status >= 400 && ex.status < 500) throw new ProviderRequestClientError(ex);
27142725
break;

0 commit comments

Comments
 (0)