(func)
return wrapped
Wrap keystone exceptions and throw Magnum specific exceptions.
Wrap keystone exceptions and throw Magnum specific exceptions.
Wrap keystone exceptions and throw Magnum specific exceptions .
def wrap_keystone_exception(func):
    """Wrap keystone exceptions and throw Magnum specific exceptions."""
    @functools.wraps(func)
    def wrapped(*args, **kw):
        try:
            return func(*args, **kw)
        except keystone_exceptions.AuthorizationFailure:
            raise AuthorizationFailure(
                client=func.__name__, message="reason: %s" % sys.exc_info()[1])
        except keystone_exceptions.ClientException:
            raise AuthorizationFailure(
                client=func.__name__,
                message="unexpected keystone client error occurred: %s"
                        % sys.exc_info()[1])
    return wrapped
def wrap_keystone_exception ( func ) : @ functools . wraps ( func ) def wrapped ( * args , * * kw ) : try : return func ( * args , * * kw ) except keystone_exceptions . AuthorizationFailure : raise AuthorizationFailure ( client = func . __name__ , message = "reason: %s" % sys . exc_info ( ) [ 1 ] ) except keystone_exceptions . ClientException : raise AuthorizationFailure ( client = func . __name__ , message = "unexpected keystone client error occurred: %s" % sys . exc_info ( ) [ 1 ] ) return wrapped