BusinessRuleException with original message

Hi Community!

I’m trying to throw Business Rule Exception, that has the original message.

BRE

For example:

If the file path is incorrect, I want to throw Business Rule Exception that says automatically “File Path doesn’t exist”.
Would that be possible?

Thanks

you need put something after, New BusinessRuleException “error”

Hi @Tarek_Kariish

For writing Business Rule Exception write the syntax

New BusinessRuleException(“File Path doesn’t exist”)

Hope it helps!!

Regards,

Hi @Tarek_Kariish

if you want to propogate the exception as is in a technical language,
You can surround the activity with Try Catch where you’re anticipating this error, inside Catch select Sysemt.Exception and use a Throw activity with exception as:

new BusinessRuleException(exception.Message) , that’ll give you a technical statement.

But if you want your Business exception to be easily understood by the Business you should simple check if path exists and inside if condition: use a throw with exception as

new BusinessRuleException(" File Path doesn’t exist")

Hi @adiijaiin,

Thanks for your reply, the technical statement is exactly what I meant but how can I do New BusinessRuleException(exception.Message) without surrounding the activity with try catch?

So in short can I say that, “You don’t want any exception to be marked as a System Exception?”
If at any place you’re getting a system exception, you would be changing its type to Business Exception.

IF you wanna do so, you would have to atleast use the try catch block to do so.
Coz if you wouldn’t be catching an exception how would you be converting it to a Business exception using

new BusinessRuleException(exception.Message)

Happy to help more in case you need any further explanation.

Hi @Tarek_Kariish

We can’t send and exception.message without sorrounding it with try catch activity, when we create exceptions in the workflow we use Throw activity and then create the exception we want, in this case a businessruleexception, Try catch activity handle the error and let us continue or stop the workflow, also provide the message that appears within the Try block, if you want a message like that you should surround it with try catch activity, or else create your own message

Regards

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