app.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:flask_restapi 作者: dracarysX 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号