Package uk.co.cogitolearning.cogpar
Class ParserException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- uk.co.cogitolearning.cogpar.ParserException
-
- All Implemented Interfaces:
Serializable
public class ParserException extends RuntimeException
A simple subclass of RuntimeException that indicates errors when trying to parse the input to Parser. The exception stores the token that caused the error.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ParserException(String message)Construct the evaluation exception with a message.ParserException(String message, Token token)Construct the evaluation exception with a message and a token.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetMessage()Overrides RuntimeException.getMessage to add the token information into the error message.TokengetToken()Get the token.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
ParserException
public ParserException(String message)
Construct the evaluation exception with a message.- Parameters:
message- the message containing the cause of the exception
-
-
Method Detail
-
getToken
public Token getToken()
Get the token.- Returns:
- the token that caused the exception
-
getMessage
public String getMessage()
Overrides RuntimeException.getMessage to add the token information into the error message.- Overrides:
getMessagein classThrowable- Returns:
- the error message
-
-