Class MethodCommandExceptionHandler<E extends Throwable,S extends CommandSource>

java.lang.Object
studio.mevera.imperat.annotations.base.parsers.MethodCommandExceptionHandler<E,S>
All Implemented Interfaces:
CommandExceptionHandler<E,S>

public final class MethodCommandExceptionHandler<E extends Throwable,S extends CommandSource> extends Object implements CommandExceptionHandler<E,S>
  • Method Details

    • getExceptionType

      public Class<E> getExceptionType()
    • resolve

      public void resolve(E exception, CommandContext<S> context)
      Description copied from interface: CommandExceptionHandler
      Resolves the given exception within the provided execution context. This method is called when an exception of type E occurs during command execution, allowing for custom handling such as user notification, logging, cleanup operations, or alternative command flows.

      Implementations should be mindful of:

      • Not throwing additional exceptions unless absolutely necessary
      • Providing meaningful feedback to the command source when appropriate
      • Performing any necessary cleanup or state restoration
      • Logging errors for debugging purposes when needed

      The resolution process should be non-blocking and efficient, as it's part of the critical command execution path.

      Specified by:
      resolve in interface CommandExceptionHandler<E extends Throwable,S extends CommandSource>
      Parameters:
      exception - the exception that occurred during command execution, never null
      context - the execution context containing the source, command state, and other relevant information at the time the exception occurred, never null
      See Also: