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)

The setting FailureActionNone allows failed operations to remain symbolic:

The setting FailureAction->"Encapsulate" will encapsulate all 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:

Introduced in 2014
 (10.0)