Simple basic question about try-catch

I´m still in my evaluation and testing phase about UIpath.
While working through tutorials I´m stuck at understanding try-catch since on my side UIpath does not seem to work like shown in several tutorials.

What I did:

  1. created a sequence with a “Try catch” activity
  2. in section “Try” there´s just a log message with log level ‘info’ and as message: asdfgh (intentionally without quotes to produce an error)
  3. in section “Catch” there´s just another log message with log level ‘warn’ and message: “error” (now of course with quotes)

My expectation is that I get a warn log message ‘error’ shown in the output section but all I can see there is:
Main.xaml: Compiler error(s) encountered processing expression “asdfgh”.
‘asdfgh’ is not declared. It may be inaccessible due to its protection level.

Is my expectation wrong?
Did I forget anything for that try-catch runs as expected?

I´m using the UIpath free 2020.10.3 (fresh downloaded)
In case this question is in a wrong section of the forum please move it to the right place.
I tried to make use of the search function but all results that I read were much more complex than my setting and didnt solve my (primitive) problem


welcome to the forum

ommiting the “” turns a defined string into a usage of a variable with the name like the string content (your case: sdfgh vs " sdfgh")

As this variable is not declared during the compilation / code validation the issue is encountered and reported.

To see a try catch in action just create an exception during runtime. For learning purpose use the throw activity instead the log message (within the try section) and force an exception throwing

Thanks Peter for your quick reply and the friendly welcome!

Right now it´s still a bit difficult for me to understand and -if possible- I would like to stay with the example of 2 log messages (I got it in my RPA book (that one from Tom Taulli) as example. Would like to walk through it step by step)

I forgot to mention that I´ve created an exception - I´ll add my simple structure as screenshots maybe then it´s easier to see what´s going wrong on my end.

screenshot1 screenshot2