Package io.jmix.ui.exception
Class ExceptionHandlers
java.lang.Object
io.jmix.ui.exception.ExceptionHandlers
Class that holds the collection of exception handlers and delegates unhandled exception processing to them. Handlers
form the chain of responsibility.
A set of exception handlers is configured by defining ExceptionHandlersConfiguration
beans
in spring.xml. If a project needs specific handlers, it should define a bean of such type with its own
id, e.g. refapp_ExceptionHandlersConfiguration
An instance of this class is bound to App
.
-
Field Summary
Modifier and TypeFieldDescriptionprotected App
protected org.springframework.context.ApplicationContext
protected ExceptionHandler
protected List<UiExceptionHandler>
protected List<ExceptionHandler>
-
Constructor Summary
ConstructorDescriptionExceptionHandlers
(App app, org.springframework.context.ApplicationContext applicationContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addHandler
(ExceptionHandler handler) Adds new Web-level handler if it is not yet registered.void
addHandler
(UiExceptionHandler handler) Adds new GUI-level handler if it is not yet registered.void
Create all Web handlers defined byExceptionHandlersConfiguration
beans in spring.xml and GUI handlers defined as Spring-beans.void
handle
(com.vaadin.server.ErrorEvent event) Delegates exception handling to registered handlers.void
Remove all handlers.void
setDefaultHandler
(ExceptionHandler defaultHandler) Set the default handler instead of initialized in constructor.
-
Field Details
-
app
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
handlers
-
genericHandlers
-
defaultHandler
-
-
Constructor Details
-
ExceptionHandlers
public ExceptionHandlers(App app, org.springframework.context.ApplicationContext applicationContext)
-
-
Method Details
-
getDefaultHandler
- Returns:
- default exception handler which is used when none of registered handlers have handled an exception
-
setDefaultHandler
Set the default handler instead of initialized in constructor.- Parameters:
defaultHandler
- default handler instance
-
addHandler
Adds new Web-level handler if it is not yet registered.- Parameters:
handler
- handler instance
-
addHandler
Adds new GUI-level handler if it is not yet registered.- Parameters:
handler
- handler instance
-
handle
public void handle(com.vaadin.server.ErrorEvent event) Delegates exception handling to registered handlers.- Parameters:
event
- error event generated by Vaadin
-
createByConfiguration
public void createByConfiguration()Create all Web handlers defined byExceptionHandlersConfiguration
beans in spring.xml and GUI handlers defined as Spring-beans. -
removeAll
public void removeAll()Remove all handlers.
-