Class ParseError
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.openstreetmap.josm.tools.template_engine.ParseError
-
- All Implemented Interfaces:
java.io.Serializable
public class ParseError extends java.lang.Exception
Exception thrown in case of an error during template parsing. Usually caused by invalid user input.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private Tokenizer.Token
unexpectedToken
-
Constructor Summary
Constructors Constructor Description ParseError(int position, SearchParseError e)
Constructs a newParseError
from aSearchParseError
.ParseError(java.lang.String message)
Constructs a newParseError
with a generic message.ParseError(Tokenizer.Token unexpectedToken)
Constructs a newParseError
for an unexpected token.ParseError(Tokenizer.Token unexpectedToken, Tokenizer.TokenType expected)
Constructs a newParseError
for an unexpected token and an expected token.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Tokenizer.Token
getUnexpectedToken()
Returns the unexpected token, if any.static ParseError
unexpectedChar(char expected, char found, int position)
Constructs a newParseError
for an unexpected character.
-
-
-
Field Detail
-
unexpectedToken
private final transient Tokenizer.Token unexpectedToken
-
-
Constructor Detail
-
ParseError
public ParseError(Tokenizer.Token unexpectedToken)
Constructs a newParseError
for an unexpected token.- Parameters:
unexpectedToken
- the unexpected token
-
ParseError
public ParseError(Tokenizer.Token unexpectedToken, Tokenizer.TokenType expected)
Constructs a newParseError
for an unexpected token and an expected token.- Parameters:
unexpectedToken
- the unexpected tokenexpected
- the expected token
-
ParseError
public ParseError(int position, SearchParseError e)
Constructs a newParseError
from aSearchParseError
.- Parameters:
position
- the positione
- the cause
-
ParseError
public ParseError(java.lang.String message)
Constructs a newParseError
with a generic message.- Parameters:
message
- the detail message. The detail message is saved for later retrieval by theThrowable.getMessage()
method.
-
-
Method Detail
-
getUnexpectedToken
public Tokenizer.Token getUnexpectedToken()
Returns the unexpected token, if any.- Returns:
- the unexpected token, or null
-
unexpectedChar
public static ParseError unexpectedChar(char expected, char found, int position)
Constructs a newParseError
for an unexpected character.- Parameters:
expected
- the expected characterfound
- the found characterposition
- the position- Returns:
- a new
ParseError
-
-