# Error handling and monitoring
Ensure that your recipes run smoothly by implementing good error handling habits. Use the error monitoring step to check if an action block completed successfully. Validate your datapills with conditional actions and raise exceptions with the stop action if the incoming data is not properly formatted. Surface useful alerts with detailed and useful information about the error.
Take the hands-on tutorial on error handling and monitoring on Workato's Automation Institute. Complete the course and become a certified Automation Pro. Find out more here (opens new window)
# Error handling best practices
This section covers the best practices for recipe building for handling errors. View this recipe (opens new window) that showcases all the best practices.
- Include an error monitoring step.
- Validate datapills with Conditional actions.
- Raise exceptions with the Stop action.
- Configure Error Emails with information about the error that occured.
Example Error Handling Recipe
# 1. Error monitor step
To monitor specific steps for errors, wrap all the actions within your recipe within an error monitoring step. This allows Workato to monitor all errors, whether user created or system generated, so that they can be universally caught and handled. To do this, click on 'Add a new step', then on 'Action with error monitor'.
As in the example recipe, you should nest all your recipe steps in 'Monitor actions for error'. This will allow Workato to watch these actions for errors. Once any of the steps within the nest throws an error, you can configure the recipe to retry the monitored steps once, twice or thrice, or to skip to the next steps immediately.
If the recipe still fails after the retries, the recipe will perform the steps nested in 'On error'.
# 2. Conditional actions
Try as much as possible to prevent errors by checking the input values to key actions in your recipe, i.e. when you are writing to a destination system. Use conditional actions to validate the incoming data and stop actions to end or fail a recipe job early to reduce unnecessary processing time and API calls. This will speed up the time taken for all your jobs. You can add conditional actions by clicking on 'Add a new step', then on 'Conditional Action'.
# 3. Stop action
Carry out data validation (using conditional actions) as early as possible in the recipe and stop the recipe using the stop action the moment something is amiss. This will make the recipe more efficient and minimize unwanted processing or excess API calls. This is done in steps 4 and 6 of the recipe. The stop reason can also be changed so that a personalized error message will appear in your job report and in the error emails. The example below stops the recipe when the search object step does not yield any results.
# 4. Custom Error Emails
When configuring the send email action in Workato to send custom error emails, please ensure that the errors are added as an attachment with a descriptive filename such as errors.txt. Also ensure that the email message contains the Job URL, Recipe URL and the time which the recipe ran.
The pills for
Job URL and
Job created at can be found in the 'Properties' tab in the data tree.