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

Change error message for xhr.ontimeout #562

Closed
wants to merge 1 commit into from

Conversation

apoh
Copy link

@apoh apoh commented Sep 14, 2017

At the moment xhr.onerror and xhr.ontimeout do write the same error
message of TypeError('Network request failed') to distiguish between
this commit changes the error message for the timeout.

At the moment xhr.onerror and xhr.ontimeout do write the same error
message of TypeError('Network request failed') to distiguish between
this commit changes the error message for the timeout.
@mislav
Copy link
Contributor

mislav commented Sep 19, 2017

Thank you for your contribution. I don't, however, think that this is useful in the long run.

First of all, this ontimeout handler is only effective in Safari: 619ee08.

Second, improving this exception message in our polyfill will only create an illusion that timeouts and other request errors can be distinguished between each other, but they can't. In native implementations of fetch() in modern browsers, Firefox has an identical message “NetworkError when attempting to fetch resource” for all kinds of connection errors, including timeouts; Safari 10.1 shows the “Type error” message in all these conditions; Chrome simply shows “Failed to fetch”.

In none of these browsers is it possible to distinguish between timeouts and other kinds of errors. Therefore, this polyfill will not attempt to distinguish either.

@dewwwald
Copy link

Follow my thinking regarding this issue on this thread over here: #565 , I think that issue is much more coherent and providers a more general issue to be solved.

@mislav mislav mentioned this pull request Jul 6, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants