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 cancelled #4

Closed
BarryThePenguin opened this issue Feb 13, 2024 · 3 comments
Closed

TypeError cancelled #4

BarryThePenguin opened this issue Feb 13, 2024 · 3 comments

Comments

@BarryThePenguin
Copy link

BarryThePenguin commented Feb 13, 2024

It looks like bot Safari 14 and iOS Safari 14 can throw a TypeError with a message of cancelled when a fetch request is cancelled. Would it make sense to include here?

See also https://github.com/shuding/request-cancellation-test 👀

@sindresorhus
Copy link
Owner

Cancellation is not a network error, so I don't think it makes sense in this package.

@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2024
@BarryThePenguin
Copy link
Author

That's fair.. I guess I'm trying to achieve something more specific where I am using is-network-error to detect if an error was the result of a network error or not. Due to the multiple ways that different browsers report network errors, it's difficult to determine the cause of a particular network error.

For instance, Chrome appears to use the same error TypeError: Failed to fetch for both network errors and fetch requests that have been aborted, either using AbortSignal or from the browser itself. So in that instance it's difficult to differentiate them.

In this instance it looks like the error message produced by Safari might distinguish between a network error and aborted fetch request? If that's the case, I'll just handle the TypeError: cancelled error myself.

@sindresorhus
Copy link
Owner

In this instance it looks like the error message produced by Safari might distinguish between a network error and aborted fetch request?

Seems like that, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants