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 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.
-
Method Summary
-
Method Details
-
convert
Attempt to convert the given throwable into aCommandException
.If the exception is not recognized, then nothing should be thrown.
- Parameters:
t
- the throwable- Throws:
org.enginehub.piston.exception.CommandException
- a command exception
-