def catch_exceptions(*exceptions):
    """Catch all exceptions provided as arguments, and raise CloudApiException instead."""
    def wrap(fn):
        @functools.wraps(fn)
        def wrapped_f(*args, **kwargs):
            try:
                return fn(*args, **kwargs)
            except exceptions:
                t, value, traceback = sys.exc_info()
                # If any resource does not exist, return None instead of raising
                if str(value.status) == '404':
                    return None
                e = CloudApiException(str(value), value.reason, value.status)
                raise_(CloudApiException, e, traceback)
        return wrapped_f
    return wrap
def catch_exceptions ( * exceptions ) : def wrap ( fn ) : @ functools . wraps ( fn ) def wrapped_f ( * args , ** kwargs ) : try : return fn ( * args , ** kwargs ) except exceptions : t , value , traceback = sys . exc_info ( ) if str ( value . status ) == '404' : return None e = CloudApiException ( str ( value ) , value . reason , value . status ) raise_ ( CloudApiException , e , traceback ) return wrapped_f return wrap
Catch all exceptions provided as arguments, and raise CloudApiException instead.