def translate_cinder_exception(method):
 @functools.wraps(method)
 def wrapper(self, ctx, *args, **kwargs):
  try:
   res = method(self, ctx, *args, **kwargs)
  except (cinder_exception.ConnectionError, keystone_exception.ConnectionError) as exc:
   err_msg = encodeutils.exception_to_unicode(exc)
   _reraise(exception.CinderConnectionFailed(reason=err_msg))
  except (keystone_exception.BadRequest, cinder_exception.BadRequest) as exc:
   err_msg = encodeutils.exception_to_unicode(exc)
   _reraise(exception.InvalidInput(reason=err_msg))
  except (keystone_exception.Forbidden, cinder_exception.Forbidden) as exc:
   err_msg = encodeutils.exception_to_unicode(exc)
   _reraise(exception.Forbidden(err_msg))
  return res
 return wrapper

def translate_cinder_exception ( method ) : @ functools . wraps ( method ) def wrapper ( self , ctx , * args , ** kwargs ) : try : res = method ( self , ctx , * args , ** kwargs ) except ( cinder_exception . ConnectionError , keystone_exception . ConnectionError ) as exc : err_msg = encodeutils . exception_to_unicode ( exc ) _reraise ( exception . CinderConnectionFailed ( reason = err_msg ) ) except ( keystone_exception . BadRequest , cinder_exception . BadRequest ) as exc : err_msg = encodeutils . exception_to_unicode ( exc ) _reraise ( exception . InvalidInput ( reason = err_msg ) ) except ( keystone_exception . Forbidden , cinder_exception . Forbidden ) as exc : err_msg = encodeutils . exception_to_unicode ( exc ) _reraise ( exception . Forbidden ( err_msg ) ) return res return wrapper
transforms a cinder exception but keeps its traceback intact .