A - The actor typepublic class RuntimeExceptionAdapter<A extends CommandActor> extends java.lang.Object implements CommandExceptionHandler<A>
ErrorContexts.
This works by creating a function and annotating it with RuntimeExceptionAdapter.HandleException.
The function parameters dictate the conditions that this function works in.
Throwable type, it will handle exceptions
of such type
ErrorContext type, it will handle
exceptions of such context
CommandParameter parameter, it will handle error
contexts of type ErrorContext.ParsingParameter and automatically get the parameter
ParameterNode parameter, it will handle error
contexts of type ErrorContext.ParsingParameter and automatically get the parameter node
LiteralNode parameter, it will handle error
contexts of type ErrorContext.ParsingLiteral and automatically get the literal node
The function will also get these parameters automatically:
| Modifier and Type | Class and Description |
|---|---|
static interface |
RuntimeExceptionAdapter.HandleException
Annotation for creating handler functions.
|
| Constructor and Description |
|---|
RuntimeExceptionAdapter()
Registers all
RuntimeExceptionAdapter.HandleException-annotated methods to this
exception handler |
| Modifier and Type | Method and Description |
|---|---|
protected static @NotNull java.lang.String |
fmt(@NotNull java.lang.Number number) |
void |
handleException(@NotNull java.lang.Throwable throwable,
@NotNull ErrorContext<A> errorContext)
Handles the given exception.
|
public RuntimeExceptionAdapter()
RuntimeExceptionAdapter.HandleException-annotated methods to this
exception handler@NotNull
protected static @NotNull java.lang.String fmt(@NotNull
@NotNull java.lang.Number number)
public final void handleException(@NotNull
@NotNull java.lang.Throwable throwable,
@NotNull
@NotNull ErrorContext<A> errorContext)
CommandExceptionHandlerhandleException in interface CommandExceptionHandler<A extends CommandActor>throwable - Exception to handleerrorContext - The context in which the error occurred. For example,
if the error was because a parameter was invalid, this
will be a ErrorContext.ParsingParameter context,
which contains information about the parameter being parsed.