Class ArgumentParseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.spongepowered.api.util.ComponentMessageException
org.spongepowered.api.command.exception.CommandException
org.spongepowered.api.command.exception.ArgumentParseException
- All Implemented Interfaces:
Serializable
,ComponentMessageThrowable
Exception thrown when a
Parameter
cannot parse an argument.- See Also:
-
Constructor Summary
ConstructorDescriptionArgumentParseException
(@Nullable Component message, String source, int position) Return a newArgumentParseException
with the given message, source and position.ArgumentParseException
(@Nullable Component message, Throwable cause, String source, int position) Return a newArgumentParseException
with the given message, cause, source and position. -
Method Summary
Modifier and TypeMethodDescriptionReturn a string pointing to the position of the arguments when this exception occurs.@Nullable Component
Returns the text message for this exception, or null if nothing is present.int
position()
Gets the position of the last fetched argument in the provided source string.Returns the source string arguments are being parsed from.@Nullable Component
Methods inherited from class org.spongepowered.api.command.exception.CommandException
shouldIncludeUsage
Methods inherited from class org.spongepowered.api.util.ComponentMessageException
getLocalizedMessage, getMessage
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ArgumentParseException
Return a newArgumentParseException
with the given message, source and position.- Parameters:
message
- The message to use for this exceptionsource
- The source string being parsedposition
- The current position in the source string
-
ArgumentParseException
public ArgumentParseException(@Nullable Component message, Throwable cause, String source, int position) Return a newArgumentParseException
with the given message, cause, source and position.- Parameters:
message
- The message to use for this exceptioncause
- The cause for this exceptionsource
- The source string being parsedposition
- The current position in the source string
-
-
Method Details
-
componentMessage
Description copied from class:ComponentMessageException
Returns the text message for this exception, or null if nothing is present.- Specified by:
componentMessage
in interfaceComponentMessageThrowable
- Overrides:
componentMessage
in classComponentMessageException
- Returns:
- The text for this message
-
superText
-
annotatedPosition
Return a string pointing to the position of the arguments when this exception occurs.- Returns:
- The appropriate position string
-
position
public int position()Gets the position of the last fetched argument in the provided source string.- Returns:
- The source string to get position for
-
sourceString
Returns the source string arguments are being parsed from.- Returns:
- The source string
-