@contextlib.contextmanager
def convertError(sourceType, targetType):
 try:
  (yield None)
 except sourceType:
  compat.reraise(targetType(), sys.exc_info()[(-1)])

@ contextlib . contextmanager def convertError ( sourceType , targetType ) : try : ( yield None ) except sourceType : compat . reraise ( targetType ( ) , sys . exc_info ( ) [ ( - 1 ) ] )
convert an error into a different error type .