1
|
/**
|
2
|
* Copyright (C) 2018 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.vaadin.event.error;
|
10
|
|
11
|
import com.vaadin.server.ErrorEvent;
|
12
|
import com.vaadin.server.ErrorHandler;
|
13
|
|
14
|
/**
|
15
|
* @author a.kohlbecker
|
16
|
* @since Nov 8, 2018
|
17
|
*
|
18
|
*/
|
19
|
public class ErrorTypeErrorHandlerWrapper<E extends Throwable> extends ErrorTypeHandler<E> {
|
20
|
|
21
|
private static final long serialVersionUID = 856246216519945768L;
|
22
|
|
23
|
private Class<E> errorType;
|
24
|
|
25
|
private ErrorHandler errorHandler;
|
26
|
|
27
|
public ErrorTypeErrorHandlerWrapper(Class<E> errorType, ErrorHandler errorHandler){
|
28
|
this.errorType = errorType;
|
29
|
this.errorHandler = errorHandler;
|
30
|
}
|
31
|
|
32
|
@Override
|
33
|
public void error(ErrorEvent event) {
|
34
|
errorHandler.error(event);
|
35
|
}
|
36
|
|
37
|
@Override
|
38
|
public Class<E> supports() {
|
39
|
return errorType;
|
40
|
}
|
41
|
|
42
|
@Override
|
43
|
public void exception(Throwable throwable) {
|
44
|
// nothing to do, since the errorHandler is expected to provide user feedback
|
45
|
}
|
46
|
|
47
|
}
|