cutenode / cutenode/good-first-issue
Handle rate limiting
- Dominant language
- JavaScript
- Stars
- 832
- Forks
- 236
- PR merge metrics
- No merged PRs in 30d
Description
Currently, if a user runs too many searches they hit a rate limit. It would be awesome if we could pretty print a message about this rather than logging the JSON :)
```
~/GitHub/good-first-issue on master! ⌚ 16:23:45
$ good-first-issue
? Choose a project: EasyGraphQL - EasyGraphQL is a group of open source tools, with the main focus to help developers that use GraphQL or just want to sta
rt using it.
RequestError [HttpError]: API rate limit exceeded for 69.116.190.39. (But here's the good news: Authenticated requests get a higher rate limit. Check out
the documentation for more details.)
at /Users/cyren/GitHub/good-first-issue/node_modules/@octokit/request/dist-node/index.js:66:23
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async search (/Users/cyren/GitHub/good-first-issue/lib/search.js:18:20)
at async Command. (/Users/cyren/GitHub/good-first-issue/bin/good-first-issue.js:30:22) {
name: 'HttpError',
status: 403,
headers: {
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
connection: 'close',
'content-encoding': 'gzip',
'content-security-policy': "default-src 'none'",
'content-type': 'application/json; charset=utf-8',
date: 'Sat, 03 Aug 2019 20:23:50 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
status: '403 Forbidden',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
'transfer-encoding': 'chunked',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-media-type': 'github.v3; format=json',
'x-github-request-id': 'FE99:32E5:25E774:39DA78:5D45ED56',
'x-ratelimit-limit': '10',
'x-ratelimit-remaining': '0',
'x-ratelimit-reset': '1564863842',
'x-xss-protection': '1; mode=block'
},
request: {
method: 'GET',
url: 'https://api.github.com/search/issues?q=org%3Aeasygraphql%20is%3Aissue%20is%3Aopen%20label%3A%22good%20first%20issue%22&sort=updated&order=desc&per_page=30&page=1',
headers: {
accept: 'application/vnd.github.v3+json',
'user-agent': 'octokit.js/16.28.5 Node.js/12.7.0 (macOS Mojave; x64)'
},
request: { hook: [Function: bound bound register], validate: [Object] }
},
documentation_url: 'https://developer.github.com/v3/#rate-limiting'
}
```
Contributor guide
Research direction
Start in lib/search.js at the search call shown in the stack trace, then follow how bin/good-first-issue.js handles the command result. Run the CLI until a GitHub API rate-limit error occurs and make the completed behavior show a readable rate-limit message instead of the JSON error and stack trace.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, javascript, node.js
- Domain
- api, cli
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100