Register a handler for error events. Called when a connection or communication error occurs.
Suspend function called on error