how to get particular human friendly error message the and error line no.
Line if the excel is not able to open, it should give general error, like unable to open the excel incorrect file name or file name not found and the error line no.
I don’t want any complex error message…as it’s no use. i want simple and to the point.
Put your Excel Application Scope or Read Range inside a Try block and Catch the error and create your message. In the Catch block, catch System.Exception. Use a Message Box activity with a simple message.
“Unable to open the Excel file. Please check the file name or path.” & vbCrLf &
"Error at line: " & exception.StackTrace.Split({vbCrLf}, StringSplitOptions.None)(0)
Hi @sonaliaggarwal47 i want the generic one, i just gave an example,
it should be simple type, i am not aware which exception type we should choose. as ex.message giving whole history which am not interested and the line no.
strange, why UiPath don’t have a system defined variable to get the exception line no…
No there is not any variable which can give error line but you can see on which activity the error is encoountered for that you can use
“Unable to open Excel file. Please check the file name or path.” & vbCrLf &
"Error at activity: " & ex.Source
Instead of
“Unable to open the Excel file. Please check the file name or path.” & vbCrLf &
"Error at line: " & exception.StackTrace.Split({vbCrLf}, StringSplitOptions.None)(0)