def handle_error(self, error):
if issubclass(error.__class__, exception.ValenceError):
LOG.debug(traceback.format_exc())
return utils.make_response(error.status, error.as_dict())
elif hasattr(error, 'status'):
LOG.debug(traceback.format_exc())
return utils.make_response(error.code,
exception.httpexception(error))
else:
# Valence will not throw general exception in normal case, so use
# LOG.error() to record it.
LOG.error(traceback.format_exc())
exc = exception.generalexception(error,
http_client.INTERNAL_SERVER_ERROR)
return utils.make_response(http_client.INTERNAL_SERVER_ERROR, exc)
评论列表
文章目录