Saturday, September 30, 2023

Error Handling | BW 5.X

What is an Exceptions..?

An exception is a problem that arises during the execution of a program or logic. When an Exception occurs the normal flow of the program is disrupted and the program or the application terminates abnormally, which is not recommended, therefore, these exceptions are to be handled properly.

An exception can occur for many different reasons. Following are the various reasons 

  • User has entered an invalid data.
  • A file that needs to be opened cannot be found.
  • Network or DB connection has been lost in the middle of communications or the JVM has run out of memory.

How to handle exceptions in TIBCO BW 5.x

Following are the important activities to handle exceptions:

CATCH

The catch activity is used when an unhandled exception occurs

Using this we can either specify a particular exception that needs to be caught or we can specify all unhandled exceptions

More than one catch activity can be used but each activity should handle a unique exception type.


Generate Error

This activity generates an error and causes an error transition, if any error transition is present else it stops the execution of the process.

This is generally used in a group activity or in a called process.


Rethrow

This activity is always preceded by the Catch activity and it rethrows the exception identified by the catch activity. It does not contain any input or output.


Suppose A B and C are processes, A is the parent and it's top level process and begins with an event handler, A invokes B as a subprocess and B invokes C as a subprocess. 

A, B and C all include a Catch activity. 

Then A receives an event and starts, A invokes B and B invokes C. 

If an error occurs in process C, then the Catch activity in C will catch the error. If C does a Rethrow then the Catch activity in B will catch the error. If B does a Rethrow then the Catch activity in A will catch the error.

Note: Rethrow activity must be preceded at some point by a Catch activity, which is not needed in case of Generate error activity.

Ref: Tibco documentation

Thanks for reading :-)

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...