Skip to content

Commit a185ec3

Browse files
authored
Look at all error codes for limited query fallback (#5549) (#5550)
Part of #5544
1 parent 7f33502 commit a185ec3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/github/githubRepository.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ export interface IMetadata extends OctokitCommon.ReposGetResponseData {
122122
currentUser: any;
123123
}
124124

125+
interface GraphQLError {
126+
extensions: {
127+
code: string;
128+
};
129+
}
130+
125131
export class GitHubRepository implements vscode.Disposable {
126132
static ID = 'GitHubRepository';
127133
protected _initialized: boolean = false;
@@ -249,7 +255,7 @@ export class GitHubRepository implements vscode.Disposable {
249255
return this.query(query, ignoreSamlErrors);
250256
}
251257

252-
if (e.graphQLErrors && e.graphQLErrors.length && (e.graphQLErrors[0].extensions && e.graphQLErrors[0].extensions.code === 'undefinedField') && !this._areQueriesLimited) {
258+
if (e.graphQLErrors && e.graphQLErrors.length && ((e.graphQLErrors as GraphQLError[]).some(error => error.extensions.code === 'undefinedField')) && !this._areQueriesLimited) {
253259
// We're running against a GitHub server that doesn't support the query we're trying to run.
254260
// Switch to the limited schema and try again.
255261
this._areQueriesLimited = true;

0 commit comments

Comments
 (0)