Support passing error object to response.