Class ParsingException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- net.kyori.adventure.text.minimessage.ParsingException
-
- All Implemented Interfaces:
Serializable
@NonExtendable public abstract class ParsingException extends RuntimeException
An exception thrown when an error occurs while parsing a MiniMessage string.- Since:
- 4.10.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
LOCATION_UNKNOWN
-
Constructor Summary
Constructors Modifier Constructor Description protected
ParsingException(@Nullable String message)
Create a new parsing exception with only a message.protected
ParsingException(@Nullable String message, @Nullable Throwable cause)
Create a new parsing exception with a message and an optional cause.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract @Nullable String
detailMessage()
Get the detail message optionally passed with this exception.abstract int
endIndex()
Get the end index of the location which caused this exception.abstract @NotNull String
originalText()
Get the input message which caused this exception.abstract int
startIndex()
Get the start index of the location which caused this exception.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
LOCATION_UNKNOWN
public static final int LOCATION_UNKNOWN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ParsingException
protected ParsingException(@Nullable @Nullable String message)
Create a new parsing exception with only a message.- Parameters:
message
- a detail message describing the error- Since:
- 4.10.0
-
-
Method Detail
-
originalText
@NotNull public abstract @NotNull String originalText()
Get the input message which caused this exception.- Returns:
- the original input message
- Since:
- 4.10.0
-
detailMessage
@Nullable public abstract @Nullable String detailMessage()
Get the detail message optionally passed with this exception.Unlike
Throwable.getMessage()
, this method does not include location information.- Returns:
- the detail message passed to this exception
- Since:
- 4.10.0
-
startIndex
public abstract int startIndex()
Get the start index of the location which caused this exception.This index is an index into
originalText()
. If location is unknown,LOCATION_UNKNOWN
will be returned instead.- Returns:
- the start index
- Since:
- 4.10.0
-
endIndex
public abstract int endIndex()
Get the end index of the location which caused this exception.This index is an index into
originalText()
. If location is unknown,LOCATION_UNKNOWN
will be returned instead.- Returns:
- the end index
- Since:
- 4.10.0
-
-