I have a rich internet application based on javascript communicating with a webserver by ajax\https(s) requests, where I use a few external javascript libraries (e.g. qooxdoo). Because this external libraries can write error messages and I want to get noticed of them without an open error console in the developer tools, I need to collect automatically error messages on the client side error console (Chrome 47.0) by javascript code to send them back to the webserver for controlling purposes.
For this purpose I use a kind of code like this:
var origFunc = console.error
console.error = function(){
// special stuff
if(origFunc) {
origFunc.apply(console, arguments);
}
}
I get noticed by this hook in code for many errors, but I do not get noticed, when a net::ERR_INTERNET_DISCONNECTED error occurs. I see the error in the chrome error console, but the method "console.error" is not called.
Inside the chrome developer tools it is possible to reproduce this error easily by setting the network offline:chrome network throttling to offline
I even tried the following things:
- hook in the method onerror in the window object
- add an event listener for the events "ononline" and "onoffline" to the window object
- controlling the "online" property of the navigator object
None of this solutions works to catch the net::ERR_INTERNET_DISCONNECTED Error message.
How can I get noticed of net::ERR_INTERNET_DISCONNECTED error messages? Does some function or event in one of the BOM objects (console, window, navigator, etc.) exists, where I can add an event listener or hook in a function to catch this error message?