Extract Message from a business rule exception / system exception

Hi guys, I’m working with ReFramework. I’m wanting to extract the message from the business exception, and would also like to be able to extract the specific error type hit.

For example:
I have the bot throw a new BusinessRuleException(“I want to read this exception”) and it gets caught in the Business Exception try catch of the ‘Process Transaction’ section. How can I read the ‘I want to read this exception’ part? I’ve tried BusinessRuleException.Message.ToString but that does not work.

Also for System.Excpetions, lets say the system exception is a type of ‘Index outside the bound of the array’ how can I read that if multiple different types of errors (System.Exception included) will be caught in the error catch of the ‘Process Transaction’ section.

@cssc

Did you rename the variable from exception to BusinessesRuleException in catch block. If not then try below expression to fetch the error message.

            exception.Message.Tostring

Similarly for system exception also.

Yep, your post showed me the answer. I didn’t realized the message was stored in the exception value itself, and thus carried over into the variable once it was assigned. Was able to get what I was looking for using MyVariable.Message.ToString after I assigned the caught exception (Business or System) to MyVariable, thanks.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.