How to catch any exception at any time?

Hello everyone,

I search how to use the Try Catch activity, I think I understood how to use it but I want (if possible) a way to catch any exception at any time in the robot.
The fact is I want to receive a mail when the robot “crash” at any moment of the process (the process is long separate in many sequence).

Can you explain how to do it if it possible ?

Thank you

1 Like

Hi @Ludo.F

If you want to capture an exception and then you can do one thing create a string as exception=exception.message

and in finally print the value as exception in excel

Ashwin S

in that case keep the whole process inside a TRY block of TRY CATCH ACTIVITY and if any exception occurs at any point along the sequence it will get into CATCH block where we can use a SEND OUTLOOK MAIL ACTIVITY where we can send a mail to the person we want

hope this would help you
Cheers @Ludo.F

1 Like

I see what you mean, thank you.

So in the Catch block I take “System.exception” for catching all exception right ?

Is it possible to return the type of exception in the email activity or the mail will be the same for any type of exception ?

1 Like

Depending on your version have a look to following

yah of course
in the body we can mention like this
exception.Source (which activity)
exception.Message (what is the error message)

Cheers @Ludo.F

1 Like

This seems to work pretty well for now, thank you !

1 Like

Cheers @Ludo.F

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.