Class InvalidExpressionException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.github.brantunger.unruly.api.exception.UnrulyException
io.github.brantunger.unruly.api.exception.InvalidExpressionException
- All Implemented Interfaces:
Serializable
Thrown by an
ExpressionCompiler to 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.
The message says what is wrong without naming the rule, such as
contains an assignment ('=' at line 1, column 16), and the issues say where, when the
language knows. RulesEngine.load(java.util.List) reports it as a
RuleCompilationException whose message names the expression and the rule first:
Condition for rule 'prime-rate' contains an assignment ('=' at line 1, column 16). That exception has the
same issues, and this exception as its cause. Anything else an expression compiler throws is the cause too, but the
message then reads Condition for rule 'prime-rate' failed to compile: followed by the exception's message.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne problem a language found in an expression. -
Constructor Summary
ConstructorsConstructorDescriptionInvalidExpressionException(@Nullable String message) Constructs a new exception with the specified detail message and no issues.InvalidExpressionException(@Nullable String message, List<InvalidExpressionException.Issue> issues) Constructs a new exception with the specified detail message and issues.InvalidExpressionException(@Nullable String message, List<InvalidExpressionException.Issue> issues, @Nullable Throwable cause) Constructs a new exception with the specified detail message, issues and cause. -
Method Summary
Modifier and TypeMethodDescriptionissues()Returns where and what the language found wrong with the expression.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
InvalidExpressionException
Constructs a new exception with the specified detail message and no issues.- Parameters:
message- What is wrong with the expression, without the rule's name
-
InvalidExpressionException
public InvalidExpressionException(@Nullable String message, List<InvalidExpressionException.Issue> issues) Constructs a new exception with the specified detail message and issues.- Parameters:
message- What is wrong with the expression, without the rule's nameissues- Where and what the language found wrong; copied- Throws:
NullPointerException- ifissuesor one of its elements isnull
-
InvalidExpressionException
public InvalidExpressionException(@Nullable String message, List<InvalidExpressionException.Issue> issues, @Nullable Throwable cause) Constructs a new exception with the specified detail message, issues and cause.- Parameters:
message- What is wrong with the expression, without the rule's nameissues- Where and what the language found wrong; copiedcause- What the language's own compiler threw, ornull- Throws:
NullPointerException- ifissuesor one of its elements isnull
-
-
Method Details
-
issues
Returns where and what the language found wrong with the expression.- Returns:
- The issues, possibly none; unmodifiable
-