Hello guys,
I'm working on an app based on Ionic - so AngularJS. In my testing of the app I connected my device to a very slow wifi, to test how the app responds... It's awful, but not too bad because the problem is very localised.
At first the app wouldn't load at all. Channel not fired: onDOMContentLoaded appears in the console, and an alert shows Application Error - The connection to the server was unsuccessful. (file:///android_asset/www/index.html).
I followed the tip here : increase loadUrlTimeoutValue
The app stopped crashing. BUT it would remain on a white screen, until eventually the only http call in the index.html fails :
http://maps.googleapis.com/maps/api/js?key=myKey&libraries=places
The console logs Failed to load resource: net::ERR_TIMED_OUT and the app bootstraps like usual. Second thing, the images that has to be displayed in the gallery of the app won't show up, getting me a bunch of 408 (Request Time-out) after a long load time, for example
GET http://res.cloudinary.com/myimage.jpg 408 (Request Time-out)
So my guess is, on this very slow wifi, all http calls are an issue - they simply fail after some time and returns an error that the console is able to display.
My simple question : how to catch that type of error globally to be able to display a message to the user ? Or even better, listen to any http call and timeout myself after 5s or so to display the said message ?
Thanks ahead !