Return error response instead of throwing an exception