Class ParserException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.IllegalArgumentException
org.incendo.cloud.exception.parsing.ParserException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AggregateParser.AggregateParseException,BooleanParser.BooleanParseException,CharacterParser.CharParseException,CommandFlagParser.FlagParseException,DurationParser.DurationParseException,EitherParser.EitherParseException,EnumParser.EnumParseException,NumberParseException,StringParser.StringParseException,UUIDParser.UUIDParseException
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedParserException(@NonNull Class<?> argumentParser, @NonNull CommandContext<?> context, @NonNull Caption errorCaption, @NonNull CaptionVariable... captionVariables) protectedParserException(@Nullable Throwable cause, @NonNull Class<?> argumentParser, @NonNull CommandContext<?> context, @NonNull Caption errorCaption, @NonNull CaptionVariable... captionVariables) -
Method Summary
Modifier and TypeMethodDescriptionReturns the argument parser class.Get a copy of the caption variables present in this parser exception.final @NonNull CommandContext<?> context()Returns the command context.Get the error caption for this parser exceptionfinal <T> @NonNull TformatCaption(@NonNull CaptionFormatter<?, T> formatter) Formats the error caption using the givenformatter.final StringMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ParserException
protected ParserException(@Nullable Throwable cause, @NonNull Class<?> argumentParser, @NonNull CommandContext<?> context, @NonNull Caption errorCaption, @NonNull CaptionVariable... captionVariables) -
ParserException
protected ParserException(@NonNull Class<?> argumentParser, @NonNull CommandContext<?> context, @NonNull Caption errorCaption, @NonNull CaptionVariable... captionVariables)
-
-
Method Details
-
getMessage
- Overrides:
getMessagein classThrowable
-
formatCaption
@API(status=STABLE) public final <T> @NonNull T formatCaption(@NonNull CaptionFormatter<?, T> formatter) Formats the error caption using the givenformatter.- Type Parameters:
T- the type produced by the formatter- Parameters:
formatter- the formatter- Returns:
- the formatted caption
-
errorCaption
Get the error caption for this parser exception- Returns:
- The caption
-
captionVariables
Get a copy of the caption variables present in this parser exception. The returned array may be empty if no variables are present.- Returns:
- The caption variables
-
argumentParserClass
Returns the argument parser class.- Returns:
- argument parser class
-
context
Returns the command context.- Returns:
- command context
-