JakeChampion / fetch

A window.fetch JavaScript polyfill.
MIT License
25.76k stars 2.84k forks source link

fix: Have unique error messages for xhr timeouts and errors #1380

Closed bitcrumb closed 1 year ago

bitcrumb commented 1 year ago

Both xhr.onerror and xhr.ontimeout throw the same error.

I think it would be beneficial to have both handler emit errors with a different message. This way, applications can behave differently based on the error message. Especially since there is no such thing as a unique error code do distinguish both errors.