A Catch is used to handle an exception and can be attached to a Task, Call Subprocess, or Scope Element. The outgoing connection from a Catch Element will point to an Error Handler Element.
The exception that is caught can be accessed within the error handler by defining a variable name in the Catch Element, and then using a #var reference. An Element can only have one Catch Element attached.
To report unhandled errors at the Process level, you can configure a Subprocess to call on an unhandled error.
Handling errors with Catch
An error handler is a Task, Code, Call Subprocess, or Scope Element that handles exceptions. It always has an incoming connection from a Catch Element and must continue to the same Element(s) as the Element which the catch is attached to.
If an exception occurs, the execution of the throwing Element will stop, and the error handler will kick in. The return type of the error handler should be the same as the throwing Element's because the return of the error handler is used in the same way as the return of the throwing Element.
An Error handler can end the execution of the whole Process by placing a Throw Element as the end Element within a Scope.
A Catch attached to a Scope Element will catch all exceptions within the Scope. Note that the execution of the whole Scope will stop even if the exception is thrown on the very first Element within the scope. It is possible to define an error handler for the entire Process by encapsulating everything but the Start Element(s) and the final return within a Scope or by using a global error handler.
When sending an error message, such as an email, you can query for a specific Process execution graph by the execution GUID. To generate links to the Process in error emails, use the #process.executionId reference. The link for the Process Instance in tenant mytenant.frendsapp.com would be in the format of https://mytenant.frendsapp.com/ProcessInstance/Instance/{{#process.executionId}}
.
The next article is Example on How to use Throw Element.