bug #7241
closed
Missing rights are not correctly indicated in Vaadin distribution editor - flexible vaadin errorhandler is needed
Added by Andreas Müller about 6 years ago.
Updated about 5 years ago.
Description
If a user has not enough rights to edit a distribution in the Vaadin Distribution Editor this is only indicated by an ordinary exception. But it should be explained in an explicit error message.
See screenshots.
Files
- Target version changed from Unassigned CDM tickets to Release 4.14
vaddin allows setting an com.vaadin.server.ErrorHandler
for UIs and components. The caveat with this builtin appraoch is that there is only one com.vaadin.server.ErrorHandler
for any type of errors. Therefore it would make sense to implement a DelegatingErrorHandler
to which handlers for specific types of errors can be registered:
class DelegatingErrorHandler implements ErrorHandler {
Map<<? extends Exception>, ErrorTypeHandler<? extends Exception>> handlerMap;
ErrorHandler defaultHandler;
public void error(ErrorEvent event){
if(handlerMap.get(type) = null){
handlerMap.get(type).handleError(
} else {
defaultHandler.error(event);
}
public <E extends Exception> void registerHandler(Class<E> type, ErrorTypeHandler<E> handler){
handlerMap.put(type, handler);
}
}
class abstract ErrorTypeHandler<E extends Exception> implements ErrorHandler {
public final void error(ErrorEvent event){
handleError((E)event);
}
public abstract void handleError(<E> event);
}
something like this.
- Target version changed from Release 4.14 to Release 5.0
- Status changed from New to In Progress
- % Done changed from 0 to 70
- Status changed from In Progress to Resolved
- Assignee changed from Fabian Reimeier to Andreas Müller
- Assignee changed from Andreas Müller to Fabian Reimeier
I modified the DelegatingErrorHandler and ErrorTypeHandler a bit in order to allow using it generically in more contexts.
@Fabian. Please review my changes and check if everything still works for your UI.
- Assignee changed from Fabian Reimeier to Andreas Kohlbecker
Andreas Kohlbecker wrote:
I modified the DelegatingErrorHandler and ErrorTypeHandler a bit in order to allow using it generically in more contexts.
@Fabian. Please review my changes and check if everything still works for your UI.
I made some modifications and everything seems to work right now.
- Status changed from Resolved to Closed
- Subject changed from Missing rights are not correctly indicated in Vaadin distribution editor to Missing rights are not correctly indicated in Vaadin distribution editor - flexible vaadin errorhandler is needed
Also available in: Atom
PDF