def wrap_non_libcloud_exceptions(func):
 @wraps(func)
 def decorated_function(*args, **kwargs):
  try:
   return func(*args, **kwargs)
  except Exception:
   e = sys.exc_info()[1]
   if isinstance(e, LibcloudError):
    raise e
   if (len(args) >= 1):
    driver = args[0]
   else:
    driver = None
   fault = getattr(e, 'fault', None)
   if (fault and getattr(fault, 'string', None)):
    message = fault.string
   else:
    message = e.message
   raise LibcloudError(value=message, driver=driver)
 return decorated_function

def wrap_non_libcloud_exceptions ( func ) : @ wraps ( func ) def decorated_function ( * args , ** kwargs ) : try : return func ( * args , ** kwargs ) except Exception : e = sys . exc_info ( ) [ 1 ] if isinstance ( e , LibcloudError ) : raise e if ( len ( args ) >= 1 ) : driver = args [ 0 ] else : driver = None fault = getattr ( e , 'fault' , None ) if ( fault and getattr ( fault , 'string' , None ) ) : message = fault . string else : message = e . message raise LibcloudError ( value = message , driver = driver ) return decorated_function
decorators function which catches non libclouderror exceptions .