How to Get Error Message For If Comparison

I have this HTTP Request workflow that I send a value into. After sending a value and getting a value from the response. I would store it into a variable. I am testing to see If my Try/Catch would catch the error if the input value is wrong.

Here’s the error message that I get from my assign activity:

Assign CurrencyCode: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

I know that this happens If I had an extra character in the code, I was trying to catch it in the Catches part of the try catch by using and If else with condition:

exception.Message.Contains("Index was out of range")

If the condition is thru, I would throw another error message to my main file(I am using the REFramework). Unfortunately, It didn’t catch it. Is there anything wrong that I am doing here? Thank you.

@Shinjid

Did you mention System Exception in Catch block or any other exception ?

I did BusinessRuleExcpetion as I also had a BusinessRuleExpection Catch in Try/Catch Block in the Main.xaml. After throwing from here. I would send an email in the catch block on my main.xaml

@Shinjid

BusinessRule Exception can’t handle above exception. You should mention either ArrayIndexOutOfBoundException or Exception.

I did the Exception one, It worked. Thank you!

1 Like

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