@contextlib.contextmanager
def save_and_reraise_exception():
    type_, value, tb = sys.exc_info()
    try:
        yield
    except Exception:
        logging.error(_('Original exception being dropped: %s'),
                      traceback.format_exception(type_, value, tb))
        raise
    raise type_, value, tb
Save current exception, run some code and then re-raise.
dataset/ETHPy150Open Havate/havate-openstack/proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/openstack/common/excutils.py/save_and_reraise_exception