Page MenuHomeSoftware Heritage
Paste P1229

Command-Line Input
ActivePublic

Authored by olasd on Dec 2 2021, 5:02 PM.
from functools import wraps
def handle_raise_on_commit(f):
@wraps(f)
def inner(self, *args, **kwargs):
try:
f(self, *args, **kwargs)
return True
except: # noqa: E722
# Unexpected error occurred, rollback all changes and log message
LOGGER.exception("Unexpected error")
if self.raise_on_commit:
raise
return False
return inner

Event Timeline

olasd updated the paste's language from autodetect to python.Dec 2 2021, 5:03 PM