Package io.spine.logging.flogger.parser
Class ParseException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- io.spine.logging.flogger.parser.ParseException
-
- All Implemented Interfaces:
Serializable
public final class ParseException extends RuntimeException
The exception that should be thrown whenever parsing of a log message fails. This exception must not be thrown outside of template parsing.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ParseExceptionatPosition(String errorMessage, String logMessage, int position)Creates a new parse exception for situations in which the position of the error is known.ThrowablefillInStackTrace()static ParseExceptiongeneric(String errorMessage, String logMessage)Creates a new parse exception for cases where position is not relevant.static ParseExceptionwithBounds(String errorMessage, String logMessage, int start, int end)Creates a new parse exception for situations in which both the start and end positions of the error are known.static ParseExceptionwithStartPosition(String errorMessage, String logMessage, int start)Creates a new parse exception for situations in which only the start position of the error is known.-
Methods inherited from class java.lang.Throwable
addSuppressed, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Method Detail
-
withBounds
public static ParseException withBounds(String errorMessage, String logMessage, int start, int end)
Creates a new parse exception for situations in which both the start and end positions of the error are known.- Parameters:
errorMessage- the user error message.logMessage- the original log message.start- the index of the first character in the invalid section of the log message.end- the index after the last character in the invalid section of the log message.- Returns:
- the parser exception.
-
atPosition
public static ParseException atPosition(String errorMessage, String logMessage, int position)
Creates a new parse exception for situations in which the position of the error is known.- Parameters:
errorMessage- the user error message.logMessage- the original log message.position- the index of the invalid character in the log message.- Returns:
- the parser exception.
-
withStartPosition
public static ParseException withStartPosition(String errorMessage, String logMessage, int start)
Creates a new parse exception for situations in which only the start position of the error is known.- Parameters:
errorMessage- the user error message.logMessage- the original log message.start- the index of the first character in the invalid section of the log message.- Returns:
- the parser exception.
-
generic
public static ParseException generic(String errorMessage, String logMessage)
Creates a new parse exception for cases where position is not relevant.- Parameters:
errorMessage- the user error message.logMessage- the original log message.
-
fillInStackTrace
public Throwable fillInStackTrace()
- Overrides:
fillInStackTracein classThrowable
-
-