Introduction
JS7 allows a number of strategies for error handling:
- For general information see JS7 - How to apply error handling.
- The JS7 - Try-Catch Instruction allows to automatically handle job errors making:
- an order continue in the workflow,
- an order leave the workflow.
- A JS7 - Notifications can be created in case of job errors.
Try-Catch Instruction with empty Catch Block
Download example (upload .json): pdwTryCatch.workflow.json
The basic way for using the Try-Catch Instruction includes:
- adding any number of jobs or other workflow instructions to the Try block
- using an empty Catch block.
This configuration will catch the errors occurring in jobs or instructions inside the Try block:
- The order enters and immediately leaves the Catch block.
- The order will continue with the next job or instruction following the Catch block.
Feature Status:
FEATURE AVAILABILITY STARTING FROM RELEASE 2.5.0
- JS-2005Getting issue details... STATUS
For earlier JS7 releases a dummy job has to be added to the Catch block to force a successful outcome for the order.
Try-Catch Instruction with Jobs in Catch Block
Download example (upload .json): pdwTryCatchJob.workflow.json
The Try-Catch Instruction can be used:
- to add any number of jobs or other workflow instructions to the Try block
- to use a Catch block that includes one or more jobs or other workflow instructions which are aimed at recovering from a previously failed job.
This configuration will catch the errors occurring in jobs or instructions inside the Try block:
- The order enters the Catch block and executes jobs and instructions inside this block.
- If
job2b
completes successfully then the order will leave the Catch block and will continue withjob3
. - If
job2b
fails then the order will be put in the failed state, will be stopped and will remain in the Catch block to wait for user intervention. - Note that Try-Catch instructions can be nested, i.e. in a Catch block another Try-Catch instruction can be used for error handling.
- If
Try-Catch Instruction with Catch Block making Orders leave the Workflow with successful Outcome
Download example (upload .json): pdwTryCatchLeaveSuccessful.workflow.json
The Try-Catch Instruction can be used:
- to add any number of jobs or other workflow instructions to the Try block
- to use a Catch block that includes the JS7 - Finish Instruction that makes the order leave the workflow.
This configuration will catch the errors occurring in jobs or instructions inside the Try block. When entering the Catch block the order will leave the workflow and will carry a successful History outcome.
Feature Status:
FEATURE AVAILABILITY STARTING FROM RELEASE 2.5.0
- JS-2005Getting issue details... STATUS
For earlier JS7 releases users have to add a dummy job before the Finish instruction. This guarantees successful execution in order to force a successful History outcome.
Try-Catch Instruction with Catch Block making Orders leave the Workflow with failed Outcome
Download example (upload .json): pdwTryCatchLeaveFailed.workflow.json
The Try-Catch Instruction can be used:
- to add any number of jobs or other workflow instructions to the Try block:
- to use a Catch block that includes the JS7 - Fail Instruction which makes the order leave the workflow.
This configuration will catch the errors occurring in jobs or instructions inside the Try block. When entering the Catch block the order will leave the workflow and will carry a failed History outcome.
Feature Status:
FEATURE AVAILABILITY STARTING FROM RELEASE 2.5.0
- JS-2014Getting issue details... STATUS
For earlier JS7 releases users should apply the Finish instruction instead of the Fail instruction in the Catch block. This will make the order leave the workflow with a failed History outcome.