handlers.py 文件源码

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

项目:sanic 作者: channelcat 项目源码 文件源码
def default(self, request, exception):
        self.log(format_exc())
        if issubclass(type(exception), SanicException):
            return text(
                'Error: {}'.format(exception),
                status=getattr(exception, 'status_code', 500),
                headers=getattr(exception, 'headers', dict())
            )
        elif self.debug:
            html_output = self._render_traceback_html(exception, request)

            response_message = ('Exception occurred while handling uri: '
                                '"%s"\n%s')
            logger.error(response_message, request.url, format_exc())
            return html(html_output, status=500)
        else:
            return html(INTERNAL_SERVER_ERROR_HTML, status=500)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号