main.py 文件源码

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

项目:dpm-py 作者: oki-archive 项目源码 文件源码
def echo_errors(f):
    """
    Decorator for subcommands, that will echo any known errors from Client.
    """
    @wraps(f)
    def wrapped(*args, **kwargs):
        try:
            return f(*args, **kwargs)
        except dprclient.ConfigError as e:
            echo('[ERROR]: %s \n\n'
                 'To enter configuration options please run:\n'
                 '    dpmpy configure\n' % str(e))
            sys.exit(1)
        except requests.ConnectionError as e:
            echo('[ERROR] %s\n' % repr(e))
            echo('Network error. Please check your connection settings\n')
            sys.exit(1)
        except dprclient.HTTPStatusError as e:
            echo('[ERROR] %s\n' % str(e.message))
            sys.exit(1)
        except dprclient.DpmException as e:
            echo('[ERROR] %s\n' % str(e))
            sys.exit(1)

    return wrapped
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号