base.py 文件源码

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

项目:watcher-tempest-plugin 作者: openstack 项目源码 文件源码
def handle_errors(f):
    """A decorator that allows to ignore certain types of errors."""

    @functools.wraps(f)
    def wrapper(*args, **kwargs):
        param_name = 'ignore_errors'
        ignored_errors = kwargs.get(param_name, tuple())

        if param_name in kwargs:
            del kwargs[param_name]

        try:
            return f(*args, **kwargs)
        except ignored_errors:
            # Silently ignore errors
            pass

    return wrapper
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号