package.json-validator icon indicating copy to clipboard operation
package.json-validator copied to clipboard

🚀 Feature: Too many API requests should give a meaningful error

Open sdalmeida opened this issue 8 years ago • 1 comments

If I try to parse a Github package.json via the url method, I get the following error message

screen shot 2017-01-20 at 1 22 09 pm

After debugging the error, I found out that it's caused by making "too many requests" to the Github API.

/**/angular.callbacks._1t({
  "meta": {
    "Content-Type": "application/javascript; charset=utf-8",
    "X-RateLimit-Limit": "60",
    "X-RateLimit-Remaining": "0",
    "X-RateLimit-Reset": "1484939293",
    "X-GitHub-Media-Type": "github.v3; format=json",
    "status": 403
  },
  "data": {
    "message": "API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
    "documentation_url": "https://developer.github.com/v3/#rate-limiting"
  }
})

Would be nice if the error was more meaningful. Something like this would be nice

{
  "valid": "false",
  "critical":" Github API limit exceeded! Please wait a few minutes before making another request."
}

sdalmeida avatar Jan 20 '17 19:01 sdalmeida

This would be very nice, PR welcome :)

LinusU avatar Jan 20 '17 20:01 LinusU