Class ParsingException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
net.kyori.adventure.text.minimessage.ParsingException
- All Implemented Interfaces:
Serializable
An exception thrown when an error occurs while parsing a MiniMessage string.
- Since:
- 4.10.0
- See Also:
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
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.protected
ParsingException
(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) Create a new parsing exception with a message and an optional cause. -
Method Summary
Modifier and TypeMethodDescriptionabstract @Nullable String
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
Get the input message which caused this exception.abstract int
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 Details
-
LOCATION_UNKNOWN
public static final int LOCATION_UNKNOWN- See Also:
-
-
Constructor Details
-
ParsingException
Create a new parsing exception with only a message.- Parameters:
message
- a detail message describing the error- Since:
- 4.10.0
-
ParsingException
Create a new parsing exception with a message and an optional cause.- Parameters:
message
- a detail message describing the errorcause
- the cause- Since:
- 4.10.0
-
ParsingException
protected ParsingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) Create a new parsing exception with a message and an optional cause.- Parameters:
message
- a detail message describing the errorcause
- the causeenableSuppression
- whether suppression is enabled or disabledwritableStackTrace
- whether the stack trace should be writable- Since:
- 4.13.0
-
-
Method Details
-
originalText
Get the input message which caused this exception.- Returns:
- the original input message
- Since:
- 4.10.0
-
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
-