robust.py 文件源码

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

项目:rdiff-backup 作者: sol1 项目源码 文件源码
def is_routine_fatal(exc):
    """Return string if exception is non-error unrecoverable, None otherwise

    Used to suppress a stack trace for exceptions like keyboard
    interrupts or connection drops.  Return value is string to use as
    an exit message.

    """
    if isinstance(exc, exceptions.KeyboardInterrupt):
        return "User abort"
    elif isinstance(exc, connection.ConnectionError):
        return "Lost connection to the remote system"
    elif isinstance(exc, SignalException):
        return "Killed with signal %s" % (exc,)
    elif isinstance(exc, EnvironmentError) and exc.errno == errno.ENOTCONN:
        return ("Filesystem reports connection failure:\n%s" % exc)
    return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号