Try-Catch Error: for missing files

Hi

I want Uipath to loop row by row an Excel file with the URL of different files. Some of the files maybe missing or their paths are not specified correctly in the Excel file. If that happens, I want Uipath to just move on the next row.

What is the Catch I should use?

Thank you

  1. Run for each loop on data table
  2. Use try block for activity/sequence where you understand that it’s faulty.
  3. Log message in general catch block i.e. system.exception
  4. Proceed to next line(automatically)
1 Like

@Anonymous2

Try is to Place you logic to make your sequence to run without any exceptions

Catch - Is to place your logic if your sequence got any exceptions

In your case Say you have given a path to check whether it is exist or not

If exist then catch will not execute, If not exist then catch will be executed

Hope this is clear

Mark as solution if this helps

Thanks

1 Like

Hi All

Maybe my Qn is not clear enough. I want to know the specific “Exception” I should place in the Catch for missing files or inaccessible folder location

Thank you

Are you taking about which exception block you should use in order to catch missing file?

if thats the case, use IO exception and in order to get message of exception use can use exception.message

Use can use
Exception.message or Exception.source
Which will give you more details on the exception in catch section.

Thanks

@Anonymous2

Hey,

  1. Why do you want to use try catch, you can handle this with path exists .
  2. When path exists give you false, use continue activity and it will move to next row item in for each row.
1 Like

@Anonymous2

Can you tell me which activities you are trying?

as @Lakshay_Verma said you can make sure whether the path is exist or not using pathexists activity

Hope this helps

Thanks