Commit e131b3e1 by Őry Máté

common: fail activities on any BaseException

KeyboardInterrupt wasn't catched as BaseException is the common parent
of Exception and system-exiting exceptions like KeyboardInterrupt
parent 68dd404a
...@@ -17,7 +17,9 @@ logger = getLogger(__name__) ...@@ -17,7 +17,9 @@ logger = getLogger(__name__)
def activitycontextimpl(act, on_abort=None, on_commit=None): def activitycontextimpl(act, on_abort=None, on_commit=None):
try: try:
yield act yield act
except Exception as e: except BaseException as e:
# BaseException is the common parent of Exception and
# system-exiting exceptions, e.g. KeyboardInterrupt
handler = None if on_abort is None else lambda a: on_abort(a, e) handler = None if on_abort is None else lambda a: on_abort(a, e)
act.finish(succeeded=False, result=str(e), event_handler=handler) act.finish(succeeded=False, result=str(e), event_handler=handler)
raise e raise e
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment