Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError o.response is undefined #251

Closed
lambdalisue opened this issue Apr 27, 2020 · 2 comments · Fixed by #276
Closed

TypeError o.response is undefined #251

lambdalisue opened this issue Apr 27, 2020 · 2 comments · Fixed by #276
Assignees
Labels
bug Something isn't working

Comments

@lambdalisue
Copy link
Contributor

lambdalisue commented Apr 27, 2020

The error.response on https://github.com/sindresorhus/ky/blob/master/index.js#L374
is undefined when the error is AbortError.

ky

Should I catch that exception in the retry function?

@lambdalisue
Copy link
Contributor Author

I'm sorry. I could not reproduce this error on Google Chrome / Safari thus might be my Firefox is broken.

@sholladay
Copy link
Collaborator

sholladay commented Apr 27, 2020

This looks like a legit bug in Ky, unfortunately. The error may not have a response on it, which we don't check before attempting to clone it.

In hindsight, I'm kind of regretting #201. People should almost certainly just use error.response. This shortcut provides very little value. Most people are going to destructure the options anyway. I also think that, from the hook's perspective, it's more obvious that options.error.response may be undefined, as opposed to options.response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants