# Error handling and monitoring
- Error monitoring steps check action completion and allow retrying or skipping to next steps when errors occur.
- Conditional actions (
IFcondition steps) allow you to validate input data to prevent errors.
- Stop actions halt the recipe when issues arise, reducing unnecessary operations.
- Custom error emails send notifications with error details, including a descriptive filename attachment and relevant job and recipe URLs.
Ensure that your recipes run smoothly by implementing good error handling habits. Use the handle errors step to check if an action block completed successfully. Validate your datapills with conditional actions and raise exceptions with the stop action step 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 demonstrates all the best practices.
- Include a handle errors step.
- Validate datapills with Conditional actions.
- Raise exceptions with the Stop action.
- Configure custom error emails with information about the error that occurred.
Example error handling recipe
# 1. Handle errors step
To monitor specific steps for errors, wrap all the actions within your recipe within a handle errors step. This step consists of two parts, an error monitoring block and an on error block. This allows Workato to monitor for user-created and system-generated errors, enabling you to handle all errors in a uniform way.
To add a handle errors step, click + (plus) to add a new step, and then select Handle errors.
Handle errors step
As in the example recipe, we recommend you nest all of your recipe steps in a Monitor actions for error block. This allows Workato to watch these actions for errors. If any of the steps nested within the block throw an error, you can configure the recipe to automatically retry the monitored steps one, two, or three times.
Alternatively, you can select Do not retry to proceed to the next steps immediately.
Set up auto-retry
If the recipe still fails after the retries, the recipe performs the steps nested in the On error block.
MONITOR API RECIPE REQUEST TIMEOUTS
If an API recipe includes a Handle errors step, the Monitoring block will not trigger when the API request times out, given that the recipe job will be terminated. As a result, actions in the On error block will not be executed.
# On error datapills
When you add a handle errors step to your recipe, Workato generates error-related datapills if an error occurs. This enables you to configure your recipe to handle recipe errors differently depending on the type of error, recipe step, or app that caused the error, and more.
For example, if an error occurs with a particular app, you can use conditional actions to stop the recipe job, or contact your app administrator.
Workato generates the following on error datapills:
|The type of error that occurred.
|A message describing the error.
|The number of times Workato tried to rerun the actions in the handle errors block.
|The Universally Unique Identifier (UUID) of the error. This is a 128-bit label used to identify the error.
|Errored step number
|The step on which the error occurred.
|The app that caused the error.
|The action on which the error occurred.
# 2. Conditional actions
Try as much as possible to prevent errors by checking the input values to key actions in your recipe, such as 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 + (plus) and then IF Condition.
# 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.
Stop action step
# 4. Custom error emails
Configure Workato to send custom error emails when an error occurs by using the Email by Workato send email action. We recommend including the errors as an attachment to your email and choosing a
descriptive name for the file such as
errors.txt. Additionally, make sure to include important information about the error, including the recipe URL, job URL, and job time.
Locate the datapills for the Recipe URL, Job URL, and Job created at in the Properties tab of the data tree.
Set up custom error emails
You can also map in on error datapills to further customize your error emails and surface the error type, error message, error source (recipe step, action, or app) and more.
Map datapills into your email to surface important error-related details
Last updated: 12/15/2023, 8:47:08 PM