Adds an event handler that runs when an error occurs.
An error can occur when attempting to resubscribe after a disconnection.
Errors that occur during the initial subscription process cause the
Promise returned by the subscribe()
function to reject
and do not trigger onError()
event handlers.
handler(error: Error): void
The name of the function or
the function expression to run when an error occurs.