Need help on Exception handling block

Getting an error while using Exception handling block:
Please refer below screenshot for details. Can someone please provide suggestions on this.


Test case doesn’t recognize StepErrorException class. You have to either import it or use full path as you did in previous throw statements.

Thank You for your response. Can you please provide me import lines ?

I am new to Automation :blush:

It is the same path what you use in your code. :slight_smile: Try to add this line to the import section of your script:
import com.kms.katalon.core.exception.StepErrorException

:smile: Thank You …

This question and answer helped me as well Thanks to you both. :slight_smile:

How to handle arrays using katalon?
Kindly provide the solution.

The same way as in Java.

String[] animals = ["cat", "dog", "cow"]
println animals[1]

Console output:


My test case requires some transaction data to be captured from the application and dump into an excel file (which I have achieved using custom keyword). I have called the keyword at the end of my test step before closing of the browser assuming my test case has passed. However, if a test step fails in between this step is not executed and i lose my transaction data. Can someone suggest me how can i ensure to dump this data in excel even if my test case fails in between?

In selenium, I used to achieve this with the help of try… catch… blocks.

Appreciate the quick response.