Saturday, September 30, 2023

Error Handling | BW 6.X

Errors (or faults) can occur when executing a business process. 

Using fault handlers you can catch faults or exceptions and create fault-handling procedures to deal with potential runtime errors in your process definitions.

Fault handlers are the recommended way to catch faults or exceptions in a process. Two types of fault handlers are available: 

1. Catch Specific Fault 
2. Catch All Faults.

Fault handlers are defined at the scope level, as a result you can catch faults or exceptions thrown by activities within a scope. 

To catch faults or exceptions specific to an individual activity, you need to define a new scope for that individual activity and attach a fault handler to the new scope.

At runtime, once a fault handler is executed, the associated scope will not complete due to the error thrown. 

If a fault is not thrown in the fault handler, the process execution continues with the first activity that follows the scope. If a fault is thrown in the fault handler, then the engine looks for an enclosing scope that is designed to handle the fault. 

If one is found, the engine executes it. Once the enclosing fault handler finishes its execution, the engine executes the next activity following the scope. If no fault handlers are found in the enclosing scopes, then the job terminates with a fault.

Fault handlers can be defined at the process level, or at a scope level within a process
If the fault handlers are defined at the scope level, you can catch exceptions thrown by activities within a scope. 

How to define Fault handlers for a scope:
  • Create a group for one or more activities (where exceptions are expected) and right click and select Scope
  • Move the cursor right underneath the scope's lower border to view the icons to create fault handlers. 


1. For Catch Specific Fault :
Select the activity  - right click and select Catch and then select the expected exception. Then catch block will be created automatically with the selected exception.


2. Catch All Faults.
Select the activity- right click and select Catch All. Then catch block will be created automatically.



Process Level:
Move the cursor right underneath the process's lower border to view the icons to create fault handlers.





Best practice : Create a sub-process for complete exception handling and invoke it in your actual business process.

Thanks for reading :-)

Source: Tibco documentation

No comments:

Post a Comment

XML Palette Activities

The XML palette provides activities for parsing XML strings into schemas and rendering schemas into XML strings Parse XML: Parse XML  is use...