FailureAction

FailureAction

is an option to Query and related functions that determines what should happen when a failure or message is generated.

Details

  • The following settings can be given:
  • Noneignore all messages and failures
    "Abort"abort the entire computation when a message is issued
    "Drop"drop the results of operations that issue messages
    "Encapsulate"wrap operations that issue messages in a Failure object
    "Replace"replace with a placeholder form
    {act,f}perform the action and apply f to the Failure object
  • With the setting {"Replace",f}, the value generated by applying f to the Failure object is used as the placeholder form.

Examples

open allclose all

Basic Examples  (1)

Create sample data:

The setting FailureActionNone takes no special action on the result:

The setting FailureAction->"Encapsulate" encapsulates failed results in a Failure object:

The setting FailureAction->"Replace" replaces failed results with a placeholder. For the function Query, this placeholder is a Missing object:

The setting FailureAction->"Drop" causes failed results to be dropped from the final expression:

The setting FailureAction->"Abort" aborts the computation, returning a Failure object instead:

Scope  (1)

The setting FailureAction->{"Drop",f} can be used to perform an action before dropping a failed result:

The setting FailureAction->{"Replace",f} can be used to specify a replacement that is a function of the failure:

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

Text

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

CMS

Wolfram Language. 2014. "FailureAction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FailureAction.html.

APA

Wolfram Language. (2014). FailureAction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FailureAction.html

BibTeX

@misc{reference.wolfram_2023_failureaction, author="Wolfram Research", title="{FailureAction}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/FailureAction.html}", note=[Accessed: 19-April-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_failureaction, organization={Wolfram Research}, title={FailureAction}, year={2014}, url={https://reference.wolfram.com/language/ref/FailureAction.html}, note=[Accessed: 19-April-2024 ]}