good-first-issue icon indicating copy to clipboard operation
good-first-issue copied to clipboard

Handle failed queries

Open bnb opened this issue 6 years ago • 3 comments

Just tried validating #122 again and got a very different kind of error:

$ good-first-issue debugger.html
RequestError [HttpError]: Validation Failed
    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.<anonymous> (/Users/cyren/GitHub/good-first-issue/bin/good-first-issue.js:30:22) {
  name: 'HttpError',
  status: 422,
  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',
    'cache-control': 'no-cache',
    connection: 'close',
    'content-length': '306',
    'content-security-policy': "default-src 'none'",
    'content-type': 'application/json; charset=utf-8',
    date: 'Sat, 03 Aug 2019 20:07:08 GMT',
    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
    server: 'GitHub.com',
    status: '422 Unprocessable Entity',
    'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'deny',
    'x-github-media-type': 'github.v3; format=json',
    'x-github-request-id': 'FC8D:1808:23917AF:43744CB:5D45E96C',
    'x-ratelimit-limit': '10',
    'x-ratelimit-remaining': '9',
    'x-ratelimit-reset': '1564862888',
    'x-xss-protection': '1; mode=block'
  },
  request: {
    method: 'GET',
    url: 'https://api.github.com/search/issues?q=repo%3Adevtools-html%2Fdebugger.html%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] }
  },
  errors: [
    {
      message: 'The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.',
      resource: 'Search',
      field: 'q',
      code: 'invalid'
    }
  ],
  documentation_url: 'https://developer.github.com/v3/search/'
}

bnb avatar Aug 03 '19 20:08 bnb

Looks like this specific issue can be solved relatively easily – the Firefox debugger changed repos and good-first-issue labels, apparently. That said, we should handle this case in the future!

bnb avatar Aug 03 '19 20:08 bnb

ÃŽ think this can be closed as duplicate?

DanielRuf avatar Aug 10 '19 11:08 DanielRuf

In most cases we could o a irect request to the repo path, get the (redirected and) final path and use this for the search endpoint.

DanielRuf avatar Aug 10 '19 11:08 DanielRuf