Neither then() nor catch() executed when request timeout in Safari
See original GitHub issueIn Safari V9.0.3 (10601.4.4), neither then()
nor catch()
is called when a request timeout occurs. Instead, Safari prints out the following error to the console:
In Chrome V49.0.2623.87 (64-bit), the catch()
callback is properly executes as expected.
Test Script Used:
fetch('http://10.255.255.1') // a non-routable IP address
.then(function(response) {
console.log("response.ok", response.ok);
}).catch(function(error) {
console.log('Failed: ', error)
});
Without either then()
or catch()
being called on timeout, how are we supposed to handle this type of request failure for Safari browsers?
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
TimeoutError: Timed out waiting fo… | Apple Developer Forums
I have come across this issue too for me the fix was by closing Xcode and opening it again. then change the ios...
Read more >jQuery .ajax() does not work in Safari when it takes seconds to ...
Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the...
Read more >How to Fix the ERR_CONNECTION_TIMED_OUT Error - Kinsta
Right click on your current connection, this will either be Local Area Connection or Wireless Network Connection based on how you're connecting.
Read more >setTimeout() - Web APIs | MDN
The global setTimeout() method sets a timer which executes a function or specified piece of code once the timer expires.
Read more >Error handling with async/await and promises, n² ... - CatchJS
Will not catch errors thrown in another call stack via a setTimeout() or ... Then we fixed that mess with Promises, and found...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@dgraham The error returned from the catch in Chrome is:
Full console output:
@mislav I think this is asking for:
so that the promise is not trapped in the pending state.
@fabioberger What is the
error
object returned by Chrome and Firefox in yourcatch
example?