Class InvalidExpressionException

All Implemented Interfaces:
Serializable

public class InvalidExpressionException extends UnrulyException
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:
  • Constructor Details

    • InvalidExpressionException

      public InvalidExpressionException(@Nullable String message)
      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 name
      issues - Where and what the language found wrong; copied
      Throws:
      NullPointerException - if issues or one of its elements is null
    • 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 name
      issues - Where and what the language found wrong; copied
      cause - What the language's own compiler threw, or null
      Throws:
      NullPointerException - if issues or one of its elements is null
  • Method Details

    • issues

      Returns where and what the language found wrong with the expression.
      Returns:
      The issues, possibly none; unmodifiable