Package io.jmix.ui.exception
Class AbstractUiExceptionHandler
java.lang.Object
io.jmix.ui.exception.AbstractUiExceptionHandler
- All Implemented Interfaces:
UiExceptionHandler
- Direct Known Subclasses:
AccessDeniedExceptionHandler
,DeletePolicyExceptionHandler
,FileStorageExceptionHandler
,LayerLoadingExceptionHandler
,OptimisticLockExceptionHandler
,ReportExceptionHandler
,SilentExceptionHandler
,WebdavExceptionHandler
Base class for exception handlers determining their ability to handle an exception by its class name and optional
implementation of
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
.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.exception.UiExceptionHandler
UiExceptionHandler.UiContext
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
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
(String className, String message, Throwable throwable, UiExceptionHandler.UiContext context) Perform exception handling.boolean
handle
(Throwable exception, UiExceptionHandler.UiContext context) Handle an exception.
-
Field Details
-
classNames
-
-
Constructor Details
-
AbstractUiExceptionHandler
-
-
Method Details
-
handle
Description copied from interface:UiExceptionHandler
Handle an exception. Implementation class should either handle the exception and return true, or return false to delegate execution to the next handler in the chain of responsibility.- Specified by:
handle
in interfaceUiExceptionHandler
- Parameters:
exception
- exception instancecontext
- UI context- Returns:
- true if the exception has been successfully handled, false if not
-
canHandle
Should be implemented in subclasses if the exception class name is not enough to determine the ability to handle the exception.- Parameters:
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.- Returns:
- true if the exception can be handled by this handler
-
doHandle
protected abstract void doHandle(String className, String message, @Nullable Throwable throwable, UiExceptionHandler.UiContext context) Perform exception handling.- Parameters:
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
-