TryCatchアクティビティの仕様

こんにちは
UiPath Studio 2025.0.161STS Community editionのユーザーです。

TryCatchアクティビティの仕様を2点確認させてください。

1.Tryブロックで発生した例外をCatchブロックで受ける際にはTryブロックからCatchブロックに変数や引数を介した情報の受け渡しはないという認識で正しいでしょうか。
2.Tryブロックで例外が発生した場合には、Tryブロック内にスロー(Throw)アクティビティを置かなくても、例外がThrowされるという理解で正しいでしょうか。

Hi @gorby

This response was given by the Forum ChatBot, So I’m pretty sure it’ll be accurate for this question:

  1. Regarding information transfer to the Catch block:
    In UiPath, when an exception occurs within the Try block, the runtime creates an exception object. This exception object is not “transferred” via variables or regular arguments; rather, it is caught automatically by the Catch block and made available through the designated exception parameter. Any variables from the Try block do not inherently pass their state to the Catch block unless they are declared in a broader scope.
    Summary: Yes, it is correct that the exception details are not passed through variables or arguments from the Try block to the Catch block. They are automatically encapsulated in the exception object made available in Catch.

2.Regarding the need for an explicit Throw activity:
When an exception occurs in the Try block due to an error (for example, a runtime error) the exception is automatically thrown by the system—it does not require a Throw activity inside the Try block. The Throw activity is used when you need to explicitly raise an exception (for custom error handling or rethrowing after catching an exception), but if an error naturally occurs, UiPath will trigger the exception and transfer control to the Catch block even if there isn’t an explicit Throw activity.
Summary: Yes, it is correct that an exception is thrown automatically when it occurs in the Try block, even without a Throw activity.

意図が分かりにくいですが、変数はスコープ次第ですが、Try Catchが包含されるスコープで定義される変数は両方で使用可能です(情報が受け渡されるわけではありません)
Try内のSequenceで定義されている変数はCatchでは使用できません。
引数はそのファイル全体で使用可能なので、Catchでも使用可能です。

2.Tryブロックで例外が発生した場合には、Tryブロック内にスロー(Throw)アクティビティを置かなくても、例外がThrowされるという理解で正しいでしょうか。

あるアクティビティで例外が発生すれば例外はスローされますので、必ずしもスローアクティビティとは関係ありません。

意図がわかりにくいとのことなので、言い方を変えます。

TryBlockとCatchBlockで例外に関する変数(引数)を定義しなくても、例外情報が受け渡せるように見えるため、TryBlockとCatchBlockでは例外情報は変数(引数)以外の方法で例外情報を受け渡しているように見えますが、この理解で正しいでしょうか。

Tryで発生した例外(の情報)は、内部的にCatch側に引き継がれ、指定している変数に格納されますので、その理解で良いのではないかと思います。