Table of Contents

0003. Report rule errors as results by default

Status

Accepted. Recorded retroactively. Introduced in version 3.1.

Context and problem statement

A workflow often contains many rules. One rule with a typo, or one input with a missing value, should not prevent the remaining rules from being evaluated, and callers usually want to see which rule had a problem.

Decision drivers

  • A single faulty rule must not hide the results of the others.
  • Callers need the reason a rule failed.
  • Tests and strict hosts need a way to fail fast.

Considered options

  • Report problems as a failed result with an ExceptionMessage, with a setting to throw instead.
  • Always throw.
  • Always swallow errors.

Decision outcome

By default (EnableExceptionAsErrorMessage = true) a rule that cannot be parsed, compiled or run produces a failed RuleResultTree whose ExceptionMessage describes the problem. EnableExceptionAsErrorMessage = false throws the exception instead, and IgnoreException = true leaves the message empty. Configuration and programming errors (unknown workflow, invalid workflow, unknown action) always throw. See Error handling.

Consequences

  • Good: one broken rule does not stop the workflow, and the result tree explains it.
  • Good: strict callers can opt in to exceptions.
  • Bad: a caller that ignores ExceptionMessage can mistake an error for an ordinary failed rule. Check the message, or turn exceptions on in tests.
  • Bad: the interaction of the two settings needs documentation (see the error-handling reference).