Error handling in Twyla


Like any good programming language, Twyla provides support for graceful error handling. This tutorial shows you how you can handle error cases that occur in your custom Choreos.

Error Handling

In addition the normal "Next" connector, each Step in the Choreo Step Palette has a "On Error" connector which can be used for error handling. You can use this connector to follow a different workflow in the case that an error occurs in a particular step.

Taking the custom Choreo we built in the chaining tutorial, a good example of error handling would be if we use an error handler on the HTTP Request step so that if an error occurred making a request to Google, instead of entering into a loop, we set the Instructions variable to include the value of the error, and email an error report to ourselves. To do this, we use the ERRORDESCRIPTION() expression as shown in the screenshot below:

Specifying an error on the HTTP Request step

If an error occurred in the Launch Step when we were attempting to fire off the SendEmail Choreo, it would make sense to simply raise the error of the child Choreo so that you're able to see it in the Test pane or in the log data for your account. The screenshot below shows how you'd set that up.

Specifying an error on the Launch step and connecting to a Stop step

After setting the HTTP Request and Launch steps up with error handling behavior, the Choreo should look something like this:

A custom Choreo handling errors from two different steps

So that's error handling in Twyla. This new knowledge equips you to build more robust Choreos that behave in an informative manner should they encounter an error during execution.

Need Help?

We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.


Back