exceptions.py 文件源码

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

项目:botoflow 作者: boto 项目源码 文件源码
def format_exc(self, limit=None):
        """
        This is like exception.print_exc(limit) but returns a string instead
        of printing to a file.
        """
        result = ["Traceback (most recent call last):\n"]

        tb_list = self._traceback

        if limit is not None:
            tb_list = tb_list[-limit:]

        result.extend(traceback.format_list(tb_list))

        if self.cause is not None:
            result.extend(traceback.format_exception_only(self.cause.__class__,
                                                          self.cause))
            return result
        else:
            return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号