Skip to content

feat(gecko): Improve error message when Github api limit reached. #217

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 1 commit into from
Mar 7, 2017

Conversation

MJDSys
Copy link
Contributor

@MJDSys MJDSys commented Mar 6, 2017

When the Github API limit is reached, the error message now directly informs
the user. Also, when any other failure occurs the status code is reported.

This should hopefully give more info for issue #216.

@MJDSys
Copy link
Contributor Author

MJDSys commented Mar 6, 2017

I'm not sure why tests are failing with this change. Some of them seem to occur if the Github api limit is reached (I artificially did that from my computer for testing), and other happened without any changes from me. Some of them seem to happen because remote responses change. None of them seem related to the error message changing.

Copy link
Contributor

@cnishina cnishina left a comment

Choose a reason for hiding this comment

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

Ran the CircleCI test suite again and it passes. This is a great pull request because it helps describe what's going on when the request to github fails. I originally created the cached files to avoid hitting github's api not more than once per hour. Of course the user could easily get to the rate limit by cleaning out the selenium/ folder and retrying until they reach the limit.

I have a nit comment that I'd like you to change. Thanks!

@@ -157,7 +157,11 @@ export abstract class GithubApiConfigSource extends JsonConfigSource {
});

} else {
reject(new Error('response status code is not 200'));
if (response.statusCode == 403 && response.headers['x-ratelimit-remaining'] == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix this conditional. This should be combined to the conditional above as:

} else if (response.statusCode == 403 && response.headers['x-ratelimit-remaining'] == 0) {

Similar nit for the else statement below.

When the Github API limit is reached, the error message now directly informs
the user.  Also, when any other failure occurs the status code is reported.

This should hopefully give more info for issue angular#216.
@MJDSys MJDSys force-pushed the nicer_ratelimit_error branch from fd18f51 to ab7fe25 Compare March 7, 2017 01:15
@MJDSys
Copy link
Contributor Author

MJDSys commented Mar 7, 2017

I've pushed a new version with the requested change.

Copy link
Contributor

@cnishina cnishina left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the fast response.

@cnishina cnishina merged commit bb13882 into angular:master Mar 7, 2017
@MJDSys MJDSys deleted the nicer_ratelimit_error branch March 7, 2017 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants