Fail statement
The fail statement terminates the execution of a function with a failure and sets its failure result.
Any deferred statements registered by the function will then be executed in reverse order, which may alter the function's result.
Note that unlike success results, a function can only have zero or one failure result.
If the error is not captured, it is implicitely passed on.
You can turn on explicit error handling with a ?
after the function signature. As a shorthand, the error can be passed on using a question mark ?
after the call.
Example of defer statement modifying the failure result.
It is invalid to use the fail statement in a function with no failure result.