Skip to content

Guard PR data #1127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/github/githubRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@ export class GitHubRepository implements IGitHubRepository, vscode.Disposable {
});

const hasMorePages = !!result.headers.link && result.headers.link.indexOf('rel="next"') > -1;
if (!result.data) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like a nit pick, but since this is a scenario we can't identify, i think we should log a warning and leave a comment in the code stating why, link to the issue or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, PTAL.

// We really don't expect this to happen, but it seems to (see #574).
// Log a warning and return an empty set.
Logger.appendLine(`Warning: no result data for ${remote.owner}/${remote.repositoryName} Status: ${result.status}`);
return {
pullRequests: [],
hasMorePages: false,
};
}

const pullRequests = result.data
.map(
pullRequest => {
Expand Down