Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Throw a Failure object to the nearest enclosing CatchFailure
ResourceFunction["ThrowFailure"]["msg",args …] throws a failure object with the tag General, message "msg" and message parameters args to be caught by the nearest enclosing ResourceFunction["CatchFailure"]. | |
ResourceFunction["ThrowFailure"][head::msg,args …] specifies a message template and tag to use for the failure object. | |
ResourceFunction["ThrowFailure"][] throws $Failed. |
Throw and catch a generic Failure:
| In[1]:= | ![]() |
| Out[1]= | ![]() |
Throw and catch a Failure using the specified message template and tag:
| In[2]:= |
| Out[2]= |
Throw and catch $Failed:
| In[3]:= |
| Out[3]= |
Calling ThrowFailure without an enclosing CatchFailure prints a message and returns $Aborted:
| In[4]:= |
| Out[4]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License