Class CommandException

All Implemented Interfaces:
Serializable

public class CommandException extends RuntimeException
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:
  • Constructor Details

    • CommandException

      public CommandException(String message)
      Creates a new CommandException with a message.
      Parameters:
      message - the error message
    • CommandException

      public CommandException(String message, Throwable cause)
      Creates a new CommandException with a message and cause.
      Parameters:
      message - the error message
      cause - the underlying cause
    • CommandException

      public CommandException(String message, CommandException.Type type)
      Creates a new CommandException with a message and type.
      Parameters:
      message - the error message
      type - the exception type
    • CommandException

      public CommandException(String message, Throwable cause, CommandException.Type type)
      Creates a new CommandException with a message, cause, and type.
      Parameters:
      message - the error message
      cause - the underlying cause
      type - the exception type
  • Method Details

    • getType

      public CommandException.Type getType()
      Returns the type of this exception.
      Returns:
      the exception type
    • syntax

      public static CommandException syntax(String message)
      Creates a syntax exception indicating invalid command syntax.
      Parameters:
      message - the error message
      Returns:
      a new CommandException of type SYNTAX
    • permission

      public static CommandException permission(String permission)
      Creates a permission exception indicating missing permissions.
      Parameters:
      permission - the missing permission
      Returns:
      a new CommandException of type PERMISSION
    • argument

      public static CommandException argument(String argument, String message)
      Creates an argument exception indicating an invalid argument.
      Parameters:
      argument - the argument name
      message - the error message
      Returns:
      a new CommandException of type ARGUMENT