OperationCancelled#
- exception rapidtools.core.OperationCancelled[source]#
Bases:
RuntimeErrorRaised by a component when its
cancel_eventhas been set.The exception derives from
RuntimeErrorso that callers who do not care about cancellation specifically can still catch it with a generic handler, while callers that do can distinguish a user-requested stop from a genuine failure.Example
>>> import threading >>> from rapidtools.core import OperationCancelled, raise_if_cancelled >>> >>> stop = threading.Event() >>> stop.set() >>> try: ... raise_if_cancelled(stop, context='tiling') ... except OperationCancelled as exc: ... print(exc) Operation cancelled during tiling.