public abstract class AbstractUiExceptionHandler extends java.lang.Object implements UiExceptionHandler
canHandle(String, String, Throwable)
method.
If you need to handle a specific exception, create a descendant of this class,
pass handled exception class names into constructor, implement
#doHandle(String, String, Throwable, UiContext)
method and annotate the class with @Component
.
UiExceptionHandler.UiContext
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.lang.String> |
classNames |
HIGHEST_PLATFORM_PRECEDENCE, LOWEST_PLATFORM_PRECEDENCE
Constructor and Description |
---|
AbstractUiExceptionHandler(java.lang.String... classNames) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canHandle(java.lang.String className,
java.lang.String message,
java.lang.Throwable throwable)
Should be implemented in subclasses if the exception class name is not enough to determine the ability to
handle the exception.
|
protected abstract void |
doHandle(java.lang.String className,
java.lang.String message,
java.lang.Throwable throwable,
UiExceptionHandler.UiContext context)
Perform exception handling.
|
boolean |
handle(java.lang.Throwable exception,
UiExceptionHandler.UiContext context)
Handle an exception.
|
public AbstractUiExceptionHandler(java.lang.String... classNames)
public boolean handle(java.lang.Throwable exception, UiExceptionHandler.UiContext context)
UiExceptionHandler
handle
in interface UiExceptionHandler
exception
- exception instancecontext
- UI contextprotected boolean canHandle(java.lang.String className, java.lang.String message, @Nullable java.lang.Throwable throwable)
className
- exception class namemessage
- exception messagethrowable
- exception instance. Can be null if the exception occurred on the server side and this
exception class isn't accessible by the client.protected abstract void doHandle(java.lang.String className, java.lang.String message, @Nullable java.lang.Throwable throwable, UiExceptionHandler.UiContext context)
className
- actual exception class namemessage
- exception messagethrowable
- exception instance. Can be null if the exception occurred on the server side and this
exception class isn't accessible by the client.context
- UI context