OperationCanceled#
- exception rapidtools.core.OperationCanceled[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.Before 0.3.0 this class was spelled
OperationCancelled, and the helpersraise_if_cancelledandis_cancelled. Those names still work and emit aDeprecationWarning.Example
>>> import threading >>> from rapidtools.core import OperationCanceled, raise_if_canceled >>> >>> stop = threading.Event() >>> stop.set() >>> try: ... raise_if_canceled(stop, context='tiling') ... except OperationCanceled as exc: ... print(exc) Operation canceled during tiling.