throw a BusinessRuleException with the message “hogehoge” in the Try block, and then use a Log Message activity in the Catch block with the message “異常発生:” + Environment.NewLine + exc.Message, ensuring the logging level is set to Info or Error.
@gorby you followed correct process but check where you are using throw activity and which catch block it is executing.
to find this use debug mode and add a break point at throw activity use Step into property to execute step by step and then you can find why it is not throwing your error message
If the exception type BusinessRuleException is not explicitly caught, and only System.Exception is handled, it will still be caught since System.Exception is a generic type. However, if no Catch block exists at all, the workflow will crash.
you are using system exception catch block but you are throwing business error.
add one more catch and change to businessruleexception there you can place log message activity with same values.
refer below screenshots to add business rule exception,
Click on Add catch
you can one catch created with system exception same like above
click on dropdown(System.Exception)
you can dropdown values
click browse types
select businessruleexception like below
Unfortunately, after modifying cacth block as you taught(See below png), “hogehoge” did not appear execution Log as well. Hope your helpful and useful answer next time.
Unfortunately, after modifying cacth block as you taught(See below png), “hogehoge” did not appear execution Log as well. Hope your helpful and useful answer next time.
You did great but you are using exc_exception instead of exception,
use same like as whatever you have given in system exception block log message. to avoid more conflict copy your log message from system exception block and past it in business exception OR
modify that as below.
you can use exception.message i am seeing in your screenshot exc_exception used can you modify that
Hi, I cannot take your word for it. Do you understand the UiPath Specification?
I was taught if BusinessRuleException section does not exist in Catch block BusinessRuleException can be escalated to System.Exception section automatically in Catch block because System.Exception is the top level exception class.
Since System.Exception is the last man standing in exception class, System.Exception section can handle all level exception classes solely.
Therefore, NO Need to put BusinessRuleException section in Catch Block in this case.
Pls study UiPath more before teaching others.
I found “hogehoge” appeared in execution log after I wrote "異常発生:" + Environment.NewLine + exception.message
in Log message activity.
Upon reflecting this fact, it seems it is useless to make New exception variable by myself in general.
Are there any specific reason to make New exception variable by myself?
Pls let me know if you know this.
it depends on our logic, there is no need to create any extra variables because by default exception variable will create if you are using try catch.
if you want to export that error message from one workflow to another workflow you must need to create an argument and store that value in that argument.
If you got all of your doubts and solution, please mark my post as solution.
Hey @gorby San put you click in the Try block and in the catch use system.exception and pass your exception and use one another try catch and in that catch section take one log message and pass (exception.meesage)