Exception Handling vs Failure Handling

Hi,

What is the difference between exception handling and failure handling? By setting Failure handling as optional I am handling all the exceptions. So why is there the provision of try - catch block in Katalon? And is there any need for exception handling post setting Failure Handling as Optional?

Hi @dsoni

Failure handling does indeed handle all exceptions, because all exceptions lead to failures. However, exception handling allows you to react differently to different exceptions.

For example, upon encountering an ElementNotFoundException you may choose to print a message or switch to another XPath and retry, versus, say, when you encounter a NullPointerException you may choose to simply ignore this exception (for whatever reason).

Regards !

1 Like

Thanks @ThanhTo

Failure Handling is able to handle some exceptions. But I still get exceptions and abnormal termination of program.
The scenario is ==>
Test Case invokes a Custom Keyword.
The Custom Keyword invokes another keyword to write into an excel file which throws an exception and causes the program to terminate. Why is Failure Handling not applicable there

Hi @dsoni

Can you provide me with more information: screenshots, log errors and the content of your scripts (if possible, you can censor sensitive information) ? I can’t diagnose the root of the problem yet without more info.

Regards !

Hi @ThanhTo

The issue is resolved. I made a programming mistake.