robust.py 文件源码

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

项目:rdiff-backup 作者: sol1 项目源码 文件源码
def catch_error(exc):
    """Return true if exception exc should be caught"""
    for exception_class in (rpath.SkipFileException, rpath.RPathException,
                            librsync.librsyncError, C.UnknownFileTypeError,
                            zlib.error):
        if isinstance(exc, exception_class): return 1
    if (isinstance(exc, EnvironmentError) and
        # the invalid mode shows up in backups of /proc for some reason
        (exc[0] in ('invalid mode: rb', 'Not a gzipped file') or
         errno.errorcode.has_key(exc[0]) and
         errno.errorcode[exc[0]] in ('EPERM', 'ENOENT', 'EACCES', 'EBUSY',
                                     'EEXIST', 'ENOTDIR', 'EILSEQ',
                                     'ENAMETOOLONG', 'EINTR', 'ESTALE',
                                     'ENOTEMPTY', 'EIO', 'ETXTBSY',
                                     'ESRCH', 'EINVAL', 'EDEADLOCK',
                                     'EDEADLK', 'EOPNOTSUPP', 'ETIMEDOUT'))):
        return 1
    return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号