public interface ExceptionConverter
Throwable
into an appropriate
CommandException
.
Methods (when invoked by a ParametricBuilder
-created command) 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 WrappedCommandException
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 CommandException
CommandException
.
If the exception is not recognized, then nothing should be thrown.
t
- the throwableCommandException
- a command exception