You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a service call with side effects that can throw checked or unchecked exceptions at runtime (e.g. a database read/write call).
The method call is embedded as a then method on a rule evaluation.
If the service method fails (i.e. throws an Exception), the rule book evaluation continues to execute.
In my use case, is it possible to configure RuleBook or each individual rule in such a way that any unhandled Exceptions stop the rule book evaluation and have the Exception bubble up back to the caller? Is there a better way to handle this scenario?
Thanks again!
The text was updated successfully, but these errors were encountered:
As you pointed out, when an exception occurs the next rule is evaluated. There are a few reasons for this. One being that the idea was faulty rule logic that resulted in exceptions should not break the rule chain. The other one is that guarding against problems with rule creation becomes needed more when those rules are POJO rules - invalid method signatures or access restrictions could cause an error. So, the decision was made where rules that error are just discarded and the rule chain marches along.
Presently, you could catch the exceptions and handle them and then return RuleState.BREAK from the then method to stop the rule chain. I think that would be your best course of action.
Hi. This is an awesome library!
Suppose the following:
then
method on a rule evaluation.In my use case, is it possible to configure
RuleBook
or each individual rule in such a way that any unhandled Exceptions stop the rule book evaluation and have the Exception bubble up back to the caller? Is there a better way to handle this scenario?Thanks again!
The text was updated successfully, but these errors were encountered: