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 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.
| Modifier and Type | Method and Description |
|---|---|
void |
convert(Throwable t)
Attempt to convert the given throwable into a
CommandException. |
void convert(Throwable t) throws CommandException
CommandException.
If the exception is not recognized, then nothing should be thrown.
t - the throwableCommandException - a command exceptionCopyright © 2010-2014. All Rights Reserved.