You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be a bug that prevents catching connection errors that can occur when the server is down or unreachable.
Current behaviour
I am trying to catch all possible errors so that I can display something in the UI if these errors occur and keep my console output clean. Most errors are catchable with one of:
However when the host is down completely, there is a TransportError that is detected (as seen by debug mode of socket.io) which does not get passed to any io.on('error', ...) event and always prints to console.
Steps to reproduce
I tried forking the fiddle but to reproduce this error, you need the server not running so it is really not appropriate.
Instead, create this html file on your local machine, open it in a browser, and look at the console output.
} catch (e) {
// Need to defer since .create() is called directly fhrom the constructor
// and thus the 'error' event can only be only bound *after* this exception
// occurs. Therefore, also, we cannot throw here at all.
setTimeout(function () { // ### STACK TRACE POINTS HERE
self.onError(e);
}, 0);
return;
}
However I presume it is actually the self.onError(e); that is bubbling up in some way that I'm not able to catch.
Disabling polling transport
If I disable the polling transport, the error becomes a websocket error: failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED or failed: Error during WebSocket handshake: Unexpected response code: 502. These are the expected errors for different test cases. The problem is still that I can't seem to catch the errors.
Other thoughts
The distinction between a connect_error and a reconnect_error is rather subtle. I feel this could be simplified to just one of the two and a parameter that specifies that attempt number. 0 would be the first attempt.
The text was updated successfully, but these errors were encountered:
There seems to be a bug that prevents catching connection errors that can occur when the server is down or unreachable.
Current behaviour
I am trying to catch all possible errors so that I can display something in the UI if these errors occur and keep my console output clean. Most errors are catchable with one of:
However when the host is down completely, there is a
TransportError
that is detected (as seen by debug mode of socket.io) which does not get passed to anyio.on('error', ...)
event and always prints to console.Steps to reproduce
I tried forking the fiddle but to reproduce this error, you need the server not running so it is really not appropriate.
Instead, create this html file on your local machine, open it in a browser, and look at the console output.
test.html
I got a little fancy with my "simple" test case...
Expected behaviour
I expect that
socket.on('error', ...)
will catch all errors that would otherwise go to the console and the console to be empty.Setup
Windows 10
(should be independent)Chrome 68
(should be independent)2.1.1
Other information
Output from browser console with Socket.IO debug enabled
Indented section is the stack trace that I can't get rid of and is the error I'd like to capture
List of events during startup (in reverse order)
Likely cause
Stack trace points to:
However I presume it is actually the
self.onError(e);
that is bubbling up in some way that I'm not able to catch.Disabling
polling
transportIf I disable the
polling
transport, the error becomes a websocket error:failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED
orfailed: Error during WebSocket handshake: Unexpected response code: 502
. These are the expected errors for different test cases. The problem is still that I can't seem to catch the errors.Other thoughts
The distinction between a
connect_error
and areconnect_error
is rather subtle. I feel this could be simplified to just one of the two and a parameter that specifies that attempt number.0
would be the first attempt.The text was updated successfully, but these errors were encountered: