Skip to content

Commit

Permalink
feat(rules-engine): added rule ID for logger error message (#2798)
Browse files Browse the repository at this point in the history
## Proposed change

Added rule ID for the logger error message in rules engine while
evaluating a rule. This helps to log the error message with an
associated rule ID, instead of just the error text.

## Related issues

#2784
  • Loading branch information
fpaul-1A authored Feb 5, 2025
2 parents e2610ad + e8cb1d6 commit 94b8f1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@o3r/rules-engine/src/engine/ruleset-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export class RulesetExecutor {
if (this.rulesEngine.debugMode) {
output.evaluation = handleRuleEvaluationDebug(rule, this.ruleset.name, output.actions, output.error, runtimeFactValues, factValues, oldFactValues, inputFacts);
} else if (output.error) {
this.rulesEngine.logger?.error(output.error);
this.rulesEngine.logger?.error(`Error while evaluating rule ID: ${rule.id}`, output.error);
this.rulesEngine.logger?.warn(`Skipping rule ${rule.name}, and the associated ruleset`);
}
return output;
Expand Down

0 comments on commit 94b8f1e

Please sign in to comment.