Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

FailureAction

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

DetailsDetails

  • 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.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

The setting FailureActionNone allows failed operations to remain symbolic:

In[1]:=
Click for copyable input
Out[1]=

The setting FailureAction->"Encapsulate" will encapsulate all failed results in a Failure object:

In[2]:=
Click for copyable input
Out[2]=

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

In[3]:=
Click for copyable input
Out[3]=

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

In[4]:=
Click for copyable input
Out[4]=

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

In[5]:=
Click for copyable input
Out[5]=
Introduced in 2014
(10.0)