public interface ExceptionConverter
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 CommandException
s 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
CommandException
s that are handled normally.
Modifier and Type | Method and Description |
---|---|
void |
convert(java.lang.Throwable t)
Attempt to convert the given throwable into a
CommandException . |
void convert(java.lang.Throwable t) throws org.enginehub.piston.exception.CommandException
CommandException
.
If the exception is not recognized, then nothing should be thrown.
t
- the throwableorg.enginehub.piston.exception.CommandException
- a command exception