Skip to content

Streaming: better client-side errors

Warren Gifford requested to merge lg/streaming-handle-errors into main

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-in error event, that fires when connecting to the source fails with Event | ErrorEvent
  • We also emit error as a named event from the server, where event.data is a string containing the error message

TODO: actually test this.

Merge request reports

Loading