Using an business exception in an if-statement

Hello,

I’m trying to use an BusinessException in an If statement…

I have multiple BusinessException’s but one of them needs to get handled different from the other ones…

I have tried researching a little bit, but found no solution.

Does anybody have any experience with workarounds?

Kind regards

Hi,

One thing you can do: Throw inside if or else as New BusinessRuleException(“some string”) and in respective catch block you can use if Exception.Message.Contains or Exception.Message.Equals(“some string”).

You can do related actions inside this if for that particular business rule.

1 Like

Will try that!

As BusinessRuleExceptions are created before throwing you can use the data dictionary of the BusinessRuleException and can set a marker