EvaluationException class
An expression was valid but could not be evaluated: a missing property, an unknown type, a failed conversion.
SpEL itself throws the subtype SpelEvaluationException, which adds the error code. Catch this type when the parse step happened earlier and only evaluation failures are expected here.
// The expression was parsed at startup; this order lacks a field.
try {
expression.getValue(context);
} on EvaluationException catch (e) {
log.warning(e.message);
}
Spring (Java):
try {
expression.getValue(context);
} catch (EvaluationException ex) {
log.warn(ex.getMessage());
}
- Inheritance
-
- Object
- ExpressionException
- EvaluationException
Constructors
- EvaluationException(String simpleMessage, {String? expressionString, int position = -1, Object? cause})
-
Creates an evaluation error with
simpleMessage.
Properties
- cause → Object?
-
The error that caused this one (a converter's or an accessor's), or
null.finalinherited - expressionString → String?
-
The text of the failed expression, or
nullwhen unknown.finalinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- message → String
-
The full message, with the expression and position; the same as
toDetailedString (Spring's
getMessage()).no setterinherited - position → int
-
The character offset in expressionString where the problem was
found, or -1 when unknown.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- simpleMessage → String
-
The reason alone, without the expression and position (Spring's
getSimpleMessage()), such asEL1044E: Unexpectedly ran out of input.finalinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDetailedString(
) → String -
Expression [text] @position: message, or only simpleMessage when the expression is unknown (Spring'stoDetailedString()).inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited