Package dev.polv.taleapi.command
Class CommandException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
dev.polv.taleapi.command.CommandException
- All Implemented Interfaces:
Serializable
Exception thrown when a command fails to execute or parse.
This exception can be thrown by CommandExecutor implementations
or during command parsing to indicate various failure conditions.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe type of command exception. -
Constructor Summary
ConstructorsConstructorDescriptionCommandException(String message) Creates a new CommandException with a message.CommandException(String message, CommandException.Type type) Creates a new CommandException with a message and type.CommandException(String message, Throwable cause) Creates a new CommandException with a message and cause.CommandException(String message, Throwable cause, CommandException.Type type) Creates a new CommandException with a message, cause, and type. -
Method Summary
Modifier and TypeMethodDescriptionstatic CommandExceptionCreates an argument exception indicating an invalid argument.getType()Returns the type of this exception.static CommandExceptionpermission(String permission) Creates a permission exception indicating missing permissions.static CommandExceptionCreates a syntax exception indicating invalid command syntax.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
CommandException
Creates a new CommandException with a message.- Parameters:
message- the error message
-
CommandException
Creates a new CommandException with a message and cause.- Parameters:
message- the error messagecause- the underlying cause
-
CommandException
Creates a new CommandException with a message and type.- Parameters:
message- the error messagetype- the exception type
-
CommandException
Creates a new CommandException with a message, cause, and type.- Parameters:
message- the error messagecause- the underlying causetype- the exception type
-
-
Method Details
-
getType
Returns the type of this exception.- Returns:
- the exception type
-
syntax
Creates a syntax exception indicating invalid command syntax.- Parameters:
message- the error message- Returns:
- a new CommandException of type SYNTAX
-
permission
Creates a permission exception indicating missing permissions.- Parameters:
permission- the missing permission- Returns:
- a new CommandException of type PERMISSION
-
argument
Creates an argument exception indicating an invalid argument.- Parameters:
argument- the argument namemessage- the error message- Returns:
- a new CommandException of type ARGUMENT
-