PropagateAborts
is an option to CheckAbort to control whether a handled abort propagates to the enclosing function.
Details
- CheckAbort[expr,failexpr] evaluates failexpr if an abort occurred during the evaluation of expr. PropagateAborts controls whether the abort signal persists past the evaluation of failexpr, propagating to the enclosing function, or if it should be cleared.
- PropagateAborts takes the following settings:
-
Automatic propagate aborts other than user-initiated aborts (which includes calls to Abort[]) True propagate all aborts False propagate no aborts
Examples
open allclose allBasic Examples (2)
By default, user aborts are not propagated outward:
In this case, the behavior is the same as PropagateAbortsFalse:
With PropagateAbortsTrue, the abort is still active after CheckAbort returns:
By default, aborts generated by reaching a time constraint are propagated outward:
In this case, the behavior is the same as PropagateAbortsTrue:
With PropagateAbortsFalse, the second argument to TimeConstrained is never reached:
Scope (2)
By default, aborts generated by reaching a memory constraint are propagated outward:
In this case, the behavior is the same as PropagateAbortsTrue:
With PropagateAbortsFalse, the second argument to MemoryConstrained is never reached:
Use PropagateAbortsFalse to allow later computations in a loop to be attempted:
With the default setting, the loop would stop as soon as one computation was aborted:
Text
Wolfram Research (2022), PropagateAborts, Wolfram Language function, https://reference.wolfram.com/language/ref/PropagateAborts.html.
CMS
Wolfram Language. 2022. "PropagateAborts." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PropagateAborts.html.
APA
Wolfram Language. (2022). PropagateAborts. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PropagateAborts.html