Package org.springframework.expression

# Class ExpressionException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.expression.ExpressionException

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `EvaluationException`, `ParseException`

public class ExpressionException extends RuntimeException
Superclass for exceptions that can occur whilst processing expressions.

Since:
  3.0
Author:
  Andy Clement, Phillip Webb
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final String`
`expressionString`
`protected int`
`position`

## Constructor Summary

Constructors
Constructor
Description
`ExpressionException(int position, String message)`
Construct a new expression exception.
`ExpressionException(int position, String message, Throwable cause)`
Construct a new expression exception.
`ExpressionException(String message)`
Construct a new expression exception.
`ExpressionException(String expressionString, int position, String message)`
Construct a new expression exception.
`ExpressionException(String expressionString, String message)`
Construct a new expression exception.
`ExpressionException(String message, Throwable cause)`
Construct a new expression exception.

## Method Summary

Modifier and Type
Method
Description
`final String`
`getExpressionString()`
Return the expression string.
`String`
`getMessage()`
Return the exception message.
`final int`
`getPosition()`
Return the position in the expression string where the problem occurred.
`String`
`getSimpleMessage()`
Return the exception simple message without including the expression that caused the failure.
`String`
`toDetailedString()`
Return a detailed description of this exception, including the expression String and position (if available) as well as the actual exception message.

### Methods inherited from class java.lang.Throwable

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### expressionString

@Nullable protected final String expressionString

### position

protected int position

## Constructor Details

### ExpressionException

public ExpressionException(String message)
Construct a new expression exception.

Parameters:
  `message` - a descriptive message

### ExpressionException

public ExpressionException(String message, @Nullable Throwable cause)
Construct a new expression exception.

Parameters:
  `message` - a descriptive message
  `cause` - the underlying cause of this exception

### ExpressionException

public ExpressionException(@Nullable String expressionString, String message)
Construct a new expression exception.

Parameters:
  `expressionString` - the expression string
  `message` - a descriptive message

### ExpressionException

public ExpressionException(@Nullable String expressionString, int position, String message)
Construct a new expression exception.

Parameters:
  `expressionString` - the expression string
  `position` - the position in the expression string where the problem occurred
  `message` - a descriptive message

### ExpressionException

public ExpressionException(int position, String message)
Construct a new expression exception.

Parameters:
  `position` - the position in the expression string where the problem occurred
  `message` - a descriptive message

### ExpressionException

public ExpressionException(int position, String message, @Nullable Throwable cause)
Construct a new expression exception.

Parameters:
  `position` - the position in the expression string where the problem occurred
  `message` - a descriptive message
  `cause` - the underlying cause of this exception

## Method Details

### getExpressionString

@Nullable public final String getExpressionString()
Return the expression string.

### getPosition

public final int getPosition()
Return the position in the expression string where the problem occurred.

### getMessage

public String getMessage()
Return the exception message. As of Spring 4.0, this method returns the same result as `toDetailedString()`.

Overrides:
  `getMessage` in class `Throwable`
See Also:
  - `getSimpleMessage()`
  - `Throwable.getMessage()`

### toDetailedString

public String toDetailedString()
Return a detailed description of this exception, including the expression String and position (if available) as well as the actual exception message.

### getSimpleMessage

public String getSimpleMessage()
Return the exception simple message without including the expression that caused the failure.

Since:
  4.0