JoshuaKGoldberg / package.json-validator

Tools to validate package.json files
MIT License
107 stars 26 forks source link

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

Open sdalmeida opened 7 years ago

sdalmeida commented 7 years ago

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."
}
LinusU commented 7 years ago

This would be very nice, PR welcome :)