Streaming: better client-side errors
Created by: lguychard
I noticed while working on https://github.com/sourcegraph/sourcegraph/pull/15522 that when the error
event fired on the event source, we would error on the observer with the whole Event
object as the error.
When trying to identify how to correctly map events to proper Error
objects, I found out that:
-
EventSource
has a built-inerror
event, that fires when connecting to the source fails withEvent | ErrorEvent
- We also emit
error
as a named event from the server, whereevent.data
is a string containing the error message
TODO: actually test this.