robust.py 文件源码

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

项目:rdiff-backup 作者: sol1 项目源码 文件源码
def check_common_error(error_handler, function, args = []):
    """Apply function to args, if error, run error_handler on exception

    This uses the catch_error predicate below to only catch
    certain exceptions which seems innocent enough.

    """
    try: return function(*args)
    except (Exception, KeyboardInterrupt, SystemExit), exc:
        TracebackArchive.add([function] + list(args))
        if catch_error(exc):
            log.Log.exception()
            conn = Globals.backup_writer
            if conn is not None: conn.statistics.record_error()
            if error_handler: return error_handler(exc, *args)
            else: return None
        if is_routine_fatal(exc): log.Log.exception(1, 6)
        else: log.Log.exception(1, 2)
        raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号