Catch exceptions and emit an error on the stream