Only send error to client if error object is passed.