PropagateAborts

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:
  • Automaticpropagate aborts other than user-initiated aborts (which includes calls to Abort[])
    Truepropagate all aborts
    Falsepropagate no aborts

Examples

open allclose all

Basic 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:

Wolfram Research (2022), PropagateAborts, Wolfram Language function, https://reference.wolfram.com/language/ref/PropagateAborts.html.

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

BibTeX

@misc{reference.wolfram_2024_propagateaborts, author="Wolfram Research", title="{PropagateAborts}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/PropagateAborts.html}", note=[Accessed: 21-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_propagateaborts, organization={Wolfram Research}, title={PropagateAborts}, year={2022}, url={https://reference.wolfram.com/language/ref/PropagateAborts.html}, note=[Accessed: 21-December-2024 ]}