def handle_user_exception(self, e):
"""
override handle_user_exception and redirect the exception to handle_api_exception
"""
exc_type, exc_value, tb = sys.exc_info()
assert exc_value is e
if isinstance(e, APIError):
return self.handle_api_exception(e)
# hook HttpException and return handle_api_exception
if isinstance(e, HTTPException) and not self.trap_http_exception(e):
# return self.handle_http_exception(e)
return self.handle_api_exception(e)
handler = self._find_error_handler(e)
if handler is None:
reraise(exc_type, exc_value, tb)
return handler(e)
评论列表
文章目录