Interface ExceptionConverter

All Known Implementing Classes:
ExceptionConverterHelper, WorldEditExceptionConverter

public interface ExceptionConverter
Used to convert a recognized Throwable into an appropriate CommandException.

Methods may throw relevant exceptions that are not caught by the command manager, but translate into reasonable exceptions for an application. However, unknown exceptions are normally simply wrapped in a CommandExecutionException and bubbled up. Only normal CommandExceptions will be printed correctly, so a converter translates one of these unknown exceptions into an appropriate CommandException.

This also allows the code calling the command to not need be aware of these application-specific exceptions, as they will all be converted to CommandExceptions that are handled normally.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Attempt to convert the given throwable into a CommandException.
  • Method Details

    • convert

      void convert(Throwable t) throws org.enginehub.piston.exception.CommandException
      Attempt to convert the given throwable into a CommandException.

      If the exception is not recognized, then nothing should be thrown.

      Parameters:
      t - the throwable
      Throws:
      org.enginehub.piston.exception.CommandException - a command exception