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
public class ArgumentParseException extends CommandException
Exception thrown when aParametercannot parse an argument.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ArgumentParseException(@Nullable Component message, String source, int position)Return a newArgumentParseExceptionwith the given message, source and position.ArgumentParseException(@Nullable Component message, Throwable cause, String source, int position)Return a newArgumentParseExceptionwith the given message, cause, source and position.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringannotatedPosition()Return a string pointing to the position of the arguments when this exception occurs.@Nullable ComponentcomponentMessage()Returns the text message for this exception, or null if nothing is present.intposition()Gets the position of the last fetched argument in the provided source string.StringsourceString()Returns the source string arguments are being parsed from.@Nullable ComponentsuperText()-
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 Detail
-
ArgumentParseException
public ArgumentParseException(@Nullable Component message, String source, int position)
Return a newArgumentParseExceptionwith 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 newArgumentParseExceptionwith 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 Detail
-
componentMessage
public @Nullable Component componentMessage()
Description copied from class:ComponentMessageExceptionReturns the text message for this exception, or null if nothing is present.- Specified by:
componentMessagein interfaceComponentMessageThrowable- Overrides:
componentMessagein classComponentMessageException- Returns:
- The text for this message
-
superText
public @Nullable Component superText()
-
annotatedPosition
public String 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
public String sourceString()
Returns the source string arguments are being parsed from.- Returns:
- The source string
-
-