eventsource icon indicating copy to clipboard operation
eventsource copied to clipboard

Request error details hidden to client

Open fabricemathis opened this issue 6 years ago • 2 comments

Say we have an eventsource client connected to a server and receiving messages.

Il the server goes down, the onerror callback is invoked, which is fine, but the event that is passed only contains { type: 'error' }

Could it be possible to add more info to the event, like the original error code ('ECONNREFUSED' for instance) ?

fabricemathis avatar Dec 21 '17 16:12 fabricemathis

The library currently emits Event for all events, but it should be possible to emit ErrorEvent instead, which can have an error property.

Do you want to have a go at implementing this?

aslakhellesoy avatar Dec 28 '17 19:12 aslakhellesoy

I'm just bubbling up the error message with Event, not creating an ErrorEvent. Let me know if this is the wrong direction.

RasPhilCo avatar Aug 21 '18 17:08 RasPhilCo