sse.js
sse.js copied to clipboard
Unhandled errors - more info
Hello!
I've recently encountered a CORS error when trying to create the SSE connection - the 'error' event was dispatched, but it does not have any information about the CORS error which appeared in the console.
The only clue that we receive in the error event is a responseCode:0 - would it be possible to include the unhandled error which caused this in the error object?
this._onStreamFailure = function(e) {
const event = new CustomEvent('error');
event.responseCode = e.currentTarget.status;
event.data = e.currentTarget.response;
this.dispatchEvent(event);
this._markClosed();
}
// maybe send the whole e object?
Thanks!
@dragos-miron Is that error detail in the original XHR error event passed to onStreamFailure?