Class MethodThrowableResolver<E extends Throwable,S extends Source>

java.lang.Object
studio.mevera.imperat.annotations.base.element.MethodThrowableResolver<E,S>
All Implemented Interfaces:
ThrowableResolver<E,S>

public final class MethodThrowableResolver<E extends Throwable,S extends Source> extends Object implements ThrowableResolver<E,S>
  • Method Details

    • getExceptionType

      public Class<E> getExceptionType()
    • resolve

      public void resolve(E exception, Context<S> context)
      Description copied from interface: ThrowableResolver
      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 ThrowableResolver<E extends Throwable,S extends Source>
      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: