Surround with Try Catch

Hi,

I would like to put the activity under try catch where once there is an error, the robot continues to run for other cells.

Which do I put it under? Try, Catch or Finally?
and what conditions do I put with?

Thanks

Hi @Shannon_Quek

So as per to your screenshot you have put in a Send Hotkey on some UiElement called Home.
SO the bot will try to perform the action if it fails, it will go to Catch, so you should use a Exception there, log some message that this thing didn’t work.
And post that bot would be resuming the next set of steps in your workflow.

If you want it to skip some steps may be you can use a flag which you can set to True Something like this in workflow
TryCatchExample.xaml (10.7 KB)

Usually we do it using throws and rethrows if they are in different workflows. But you can try the above if you’re new to UiPath

what message should I put? is it the error message or?

Hi @Shannon_Quek

  1. Put the activity which an exception might occur into the try area.
  2. Add the type of exception you want to catch and the activity you want to perform once in catch area, More than one type of exception can be caught. the Exception type can catch all exceptions.
  3. Activities in the finally area are always executed regardless of whether any exception occur.

Hi @Shannon_Quek

If you need the technical details of what error is coming, then print exception.Message
or if you need it in simpler terms you can write something like: “Cannot pass the hotkey on Home Button”