Package io.github.brantunger.unruly.api.exception
@NullMarked
package io.github.brantunger.unruly.api.exception
The exceptions the engine throws, all unchecked and all extending
UnrulyException.
RulesEngine.load(java.util.List)throwsRuleCompilationException, whosefailures()lists each problem it found.RulesEngine.run(io.github.brantunger.unruly.api.FactStore)throwsRuleExecutionException, for a failure inside a rule or one that belongs to no rule, such as a stopped run.- An expression language's compiler throws
InvalidExpressionExceptionto reject an expression;load()reports it as the cause of aRuleCompilationExceptionthat names the rule. - Misuse throws
IllegalStateException(running beforeload(), or on a closed engine) orIllegalArgumentException(a fact name rules can't use, or a fact that doesn't match its declaration). A run also throwsIllegalStateExceptionwhen, while borrowing a copy of the rules, it found the same rule list closed each time it read the engine's rules again, many times in a row, which means an engine invariant has broken rather than that the call was wrong; a reload in between starts the count again.
On either engine exception, getRuleName() names the failing rule, or is null for a failure that
isn't about one rule; getExpressionKind() says whether its
condition or its
action failed; and issues() on a
RuleCompilationException says where the language found each problem.
Types in this package are non-null unless annotated Nullable.
- See Also:
-
ClassDescriptionWhich part of a rule an expression is.Thrown by an
ExpressionCompilerto reject an expression: one that breaks a rule the engine enforces, such as a condition that assigns to a fact, or one with an error the language can point to, such as a syntax error.One problem a language found in an expression.Whether an issue stops an expression compiling.Exception thrown when a rule fails to compile, or when several do.Thrown byrun()when a run fails: because a rule's condition or action failed, or because something outside any rule did.The base runtime exception for the Unruly engine.