How to rethrow exception


I want to throw a custom exception using a script, if a file is not present in a folder.
I am using the following:

throw new Exception(“Input File Not Present”);

can anyone tell me what’s wrong?

Hi @ayush.
Can you please share your script? Do you use Custom Script action or Bot task?

I was not using the Bot Task. Rather I tried to write the code directly available in the actions flow


def customScript() {
throw new Exception(“Input File Not Present”);

And what the error did you receive? Can you please show all full error message text?

Hi @ayush,

Did you tried putting this code inside executeGroovyScript function ‘throw new Exception(“Input File Not Present”)’ and tried executing.

Please let me know if any error thrown.

If I use the customscript above, how do I set an varaiable with the message “Input File Not Present” in the exception occured section of the actions flow or set the message in as an output in the script.
I want to get the message into an string variable to use in another bot task that handles all exceptions that occurs during the execution.