transitive-bullshit / check-links

Robustly checks an array of URLs for liveness. Extremely fast ⚡
MIT License
334 stars 10 forks source link

err.statusCode is undefined #25

Open JanvanCasteren opened 1 year ago

JanvanCasteren commented 1 year ago

I just started using your library and noticed that in check-link.js you access err.statusCode. But this property is undefined when I use the library. However in can find the statuscode at err.response.statusCode

  return fetchHEAD()
    .catch((/** @type {HTTPError} */ err) => {
      console.warn('HEAD error', err)
      // TODO: if HEAD results in a `got.HTTPError`, are there status codes where
      // we can bypass the GET request?
      return fetchGET()
    })
    .catch((/** @type {Response} */ err) => {
      console.warn('GET error', err)
      return /** @type {const} */ ({
        status: 'dead',
        statusCode: err.statusCode
      })
    })
JanvanCasteren commented 1 year ago

seems to be this issue:

https://github.com/sindresorhus/got/issues/2219