Catch Action is a type of action that can be used to catch any error happening in the call.
Normally you like to make a comment or Create an issue to notify that something went wrong.
Requirements
It requires the HTTP Condition tab to be filled in. This to know when to run.
Context
The Catch action runs on the context of a folder's actions. Or top-level actions.
All child actions within a folder can potentially trigger a catch action if the HTTP response code is matching.
Mustache Variables
The action that triggered the catch action can be access by using {{parent}}
So to print the name of the action could look like this: Request {{parent.name}} has failed due to {{error}}
Examples
Example 1
Group 1
- Catch Action 1 - Http Condition = 400,500
- Action 1
- Action 2
- Action 3
- Iteration 1
- Action 5
- Iteration 1
In the above example when any Action in Group 1 is executed and the response code is either 400 or 500 then the Catch Action 1 will be triggered.
Let's say you want to add a comment on the ticket if a integrations fails, then the Catch Action would be a way to handle that.
Example 2
Catch Action All - Http Condition = 400,500
Group 1
- Catch Action 1 - Http Condition = 400,500
- Action 1
- Action 2
- Action 3
- Iteration 1
- Action 5
- Iteration 1
Group 2
- Catch Action 1 - Http Condition = 400,500
- Action 1
In the above example, there is two specific Group level of Catch Action that only will be triggered if any Action in those Groups returns an error code.
In addition, there is a top-level Catch Action that will be triggered regardless of Group 1 or Group2 action fails. This example might be that there is a comment on each ticket when something goes wrong and sends an email or creates an issue in a fallback project.
Example 3
Group 1
- Catch Action 1 - Http Condition = 400,500
- Action 1
- Action 2
- Action 3
- Iteration 1
- Action 5
- Iteration 1
- Group 1.1
- Catch Action 2
- Action 1.1
- Action 1.2
- Action 1.3
In the above example when any Action in Group 1 is executed and the response code is either 400 or 500 then the Catch Action 1 will be triggered.
Group 1.1. also has a specific Catch to those actions.
Use Parent variable to get access to which action did trigger the Catch action
{{parent.name}} | Name of the parent action |
{{parent.id}} | Id of the parent action |
{{parent.url}} | URL of the parent action |
{{parent.method}} | method of the parent action |
{{parent.description}} | description of the parent action |