@contextlib.contextmanager
def logging_error(message):
 try:
  (yield)
 except Exception as error:
  with excutils.save_and_reraise_exception():
   LOG.exception(message)

@ contextlib . contextmanager def logging_error ( message ) : try : ( yield ) except Exception as error : with excutils . save_and_reraise_exception ( ) : LOG . exception ( message )
catches exception .