org.bklab.flow.exception.consumer.FluentExceptionMessageRender Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluent-vaadin-flow Show documentation
Show all versions of fluent-vaadin-flow Show documentation
Broderick Labs for fluent vaadin flow. Inherits common Vaadin components.
package org.bklab.flow.exception.consumer;
import org.apache.http.HttpStatus;
import java.util.Arrays;
import java.util.List;
class FluentExceptionMessageRender {
public static final List exceptionMessageRenders = Arrays.asList(
new SC_REQUEST_TIMEOUT(),
new SC_REQUEST_TIMEOUT_DB(),
new SC_REQUEST_TIMEOUT_DB1()
);
private static class SC_REQUEST_TIMEOUT implements IFluentExceptionMessageRender {
@Override
public String header() {
return createHeader(HttpStatus.SC_REQUEST_TIMEOUT, " - 连接超时");
}
@Override
public String[] className() {
return classNames(
java.net.http.HttpTimeoutException.class.getName(),
java.net.ConnectException.class.getName()
);
}
@Override
public String message(Exception exception) {
return "系统无法连接到指定服务器,请联系系统管理员。";
}
}
private static class SC_REQUEST_TIMEOUT_DB implements IFluentExceptionMessageRender {
@Override
public String header() {
return createHeader(HttpStatus.SC_REQUEST_TIMEOUT, " - 连接超时");
}
@Override
public String[] className() {
return classNames(
"com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException"
);
}
@Override
public String message(Exception exception) {
return "系统无法连接到数据库服务器超时,请联系系统管理员。";
}
}
private static class SC_REQUEST_TIMEOUT_DB1 implements IFluentExceptionMessageRender {
@Override
public String header() {
return createHeader(HttpStatus.SC_REQUEST_TIMEOUT, " - 连接超时");
}
@Override
public String[] className() {
return classNames(
"com.alibaba.druid.pool.GetConnectionTimeoutException"
);
}
@Override
public String message(Exception exception) {
return "与数据库链接超时,请稍后重试。";
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy