def dispatch_request(self, *args, **kwargs):
response = super().dispatch_request(*args, **kwargs)
if isinstance(response, flask.Response):
return response
try:
response = self.prepare_response(response)
except Exception as exc:
LOG.error("Cannot build model response: %s", exc)
raise exceptions.UnknownReturnValueError from exc
try:
response = flask.json.jsonify(response)
except Exception as exc:
LOG.error("Cannot convert %s to JSON: %s", response, exc)
raise exceptions.CannotConvertResultToJSONError() from exc
return response
评论列表
文章目录