47 / 166
Explain try & catch block?
The try-catch block works the same way as Java. It is 3 sequence step Main, Try and Catch block. You execute a sequence of steps, if you faced unexpected exception/error you skip the processing and execute the catch block.
To define the Try-Catch block, follow the following steps:
- Create a new flow service using SoftwareAG designer.
- Create a new sequence and call it 'Main'.
- Create another two sequence under the 'main' sequence; call them, 'Try', and 'catch'.
Go to the properties of each sequence and configure the 'exit on' as follows:
* 'Success' for the 'Main' sequence.
*'Failure' for the 'try' sequence.
* 'Done' for the catch sequence.
The main sequence has the try, and Catch sequences. So by defining the 'exit on' parameter of for the main to 'Success', this means that if the first sequence (Try) finished successfully then exit the sequence 'Main' and the 'Catch' Block/sequence will not be executed.
The 'Try' sequence is configured to 'exit on' = 'failure', which means if one step failed, all the steps following the failed step in the 'Try' block will not be executed, and the code will jump to execute the 'Catch' block/sequence.
The 'Catch' block is configured to 'exit on' = 'done' which means that each step in the 'Catch' block must be executed regardless of the result of each step.
Asked In ::
The try-catch block works the same way as Java. It is 3 sequence step Main, Try and Catch block. You execute a sequence of steps, if you faced unexpected exception/error you skip the processing and execute the catch block.
To define the Try-Catch block, follow the following steps:
- Create a new flow service using SoftwareAG designer.
- Create a new sequence and call it 'Main'.
- Create another two sequence under the 'main' sequence; call them, 'Try', and 'catch'.
Go to the properties of each sequence and configure the 'exit on' as follows:
* 'Success' for the 'Main' sequence.
*'Failure' for the 'try' sequence.
* 'Done' for the catch sequence.
The main sequence has the try, and Catch sequences. So by defining the 'exit on' parameter of for the main to 'Success', this means that if the first sequence (Try) finished successfully then exit the sequence 'Main' and the 'Catch' Block/sequence will not be executed.
The 'Try' sequence is configured to 'exit on' = 'failure', which means if one step failed, all the steps following the failed step in the 'Try' block will not be executed, and the code will jump to execute the 'Catch' block/sequence.
The 'Catch' block is configured to 'exit on' = 'done' which means that each step in the 'Catch' block must be executed regardless of the result of each step.
It is a part of 3 sequence step. Main Block Sequnce (Exit on Success), Try Block Sequence (Exit on Failure), Catch Block Sequence (Exit on Done) It includes the following basic sections of logic:
Main Block - An outer sequence that contains a try sequence and a catch sequence:
Try Block - The try sequence executes the work that you want the service to perform.
Catch Block - The catch sequence examines any exception that occurs in the try sequence,determines whether the exception is a transient error, and indicates whether Integration Server should retry the service.
The outer sequence is used so that the catch sequence is skipped when the try sequence is successful.