UiADAv1 Exam QuestionsBrowse all questions from this exam

UiADAv1 Exam - Question 31


Consider the following code involving a Try Catch:

What will be the output after running the code?

Show Answer
Correct Answer: A

In the provided code, a BusinessRuleException is thrown in the Try block. Since there is a specific catch block for BusinessRuleException, it will handle the exception. The ‘BRE caught’ message will be logged as a part of that catch block. Following this, the Finally block will execute, logging the ‘Finally executed’ message. If the exception is rethrown within the BusinessRuleException catch block, it will propagate up the call stack after the Finally block. Thus, the correct sequence of events is: 'BRE caught', 'Finally executed', exception rethrown.

Discussion

2 comments
Sign in to comment
Mhouten
Sep 15, 2024

Could anyone explain to me why the answer should be 'B' and not for example 'C'?

TomaszWol
Nov 20, 2024

Something is missing here for me. I created a sequence in UiPath Studio to test this example and I was trying to make any of these answers possible, but none of them was. If we call Rethrow activity in Catch-block then the Finally-block is not able to be executed. Option C can't be correct because "Exception Caught" means that that Exception was thrown, not Business Rule Exception. Any ideas?