ThrowアクティビティやLog Messageアクティビティでの変数Exceptionの記述について

こんにちは。

Main.xamlの中で、ループ処理で最大再試行回数に到達した場合、Throwアクティビティを実行しています。

Throwアクティビティ内での詳細エディターでの記述がException変数の直書きexec_SystemException
は受け付けますが、
インスタンスを生成したNew exec_SystemException(“これはエラーです。”)は
exec_SystemExceptionを変数パネルでException変数として定義しているにも関わらず
exec_SystemExceptionが定義されていませんというエラーになります。
この理由を教えてください。

また、Exception変数の使い方として、Throwアクティビティ内での詳細エディターでの記述がException変数の直書きexec_SystemException
はUiPathのシステムエラー、インスタンスを生成したNew exec_SystemException(“これはエラーです。”)は、ユーザ定義のエラーと今まで理解していましたが、この理解は間違いでしょうか?間違いがあれば正しい理解をご教示ください。

New XXX

という表記は XXXクラスのインスタンスを生成するというものです。
exec_SystemExceptionというクラスはないかと思いますので、
New exec_SystemException(“これはエラーです。”) は例外になるかと思います。

@gorby

System.Exception covers all system exceptions regardless of what type of exception it is…

What UiPath generates or what we throw as new exception all fall under system.exception…

But each exception that UiPath generates fall under different subtypes for example nullreference exception is a system exception only but internal type is an io exception…

So ideally if you want to raise or catch specific exceptions then those exceptions are to be raised accordingly

Hope this helps

Cheers

ご指摘のとおり、下記はエラーになりませんでした。
New SystemException(“これはエラーです。”)

ということは、

Throwアクティビティ内での詳細エディターでの記述方法は、

エラーメッセージの内容をUiPathに任せたい場合は、
exec_SystemException
エラーメッセージの内容をプログラマがカスタマイズしたい場合は、
New SystemException(“これはエラーです。”)

と捉えれば良いでしょうか?

Hi , Thank you for your advice!
I know if I raise New BuisinessRuleException(“text”) in throw activity, I should catch this thow in Catch block BuisnessRuleSection.
Will you show me the the convenient URL to know whole Catch Block available error section like BusinessRuleexceptionSection, NullReferenceExcepton, FileNotExistExeption and so on ?

こんにちは

exec_SystemException はどこから出てきたものでしょうか?

Main.xamlの変数パネルで下記の通り定義しています。
変数一覧

自身で定義したものであれば、中身が勝手に設定されることはありませんので、上記の理解は正しく無いと思います。

@gorby

Thsi talks about few

Also the order of catch block matters…for example if you have system.exception as first catch and add nullreference or any other exception as next catch…the second catch will never be executed…you have to make sure the wider exception should be at last

And just be defining you cannot get exception details in it…you have to explicitly assign the value…in the catch block use an assign activity and assign excep_sysexcep = exception then it wpuld be initialized

Hope this helps

Cheers

ということは、
エラーメッセージの内容をUiPathに任せたい場合は、throwアクティビティの詳細エディター記述は
SystemException
が正解でしょうか?

どのようなシーンを想定されていますでしょうか?
基本的には、自身でthrowするときは、自身で内容を設定する必要があります。

ということは今回は
New SystemException(“最大再試行回数をオーバーしました。”)
と記述するのが正解ですね。

文法としては問題無いと思います。

なおSystemExceptionとSystem.Exceptionは
別物で、前者はシステム例外を指すものですので、
内容によっては良く無いかもしれません

SystemExceptionとSystem.Exceptionはそれぞれ別のクラスということでしょうか?
もしYESであれば、後者の説明リンクの共有もお願いします。

以下になります。ちなみに前者は厳密には System.SystemException です。