Display human error on lost of internet connectivity

This commit is contained in:
Laurent Clouet
2019-07-12 17:46:57 +02:00
parent a09f1ab016
commit 5d135f1681

View File

@@ -38,6 +38,7 @@ import java.net.CookieManager;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.NoRouteToHostException;
import java.net.UnknownHostException;
import java.net.URL;
import java.net.URLEncoder;
import java.security.KeyManagementException;
@@ -267,6 +268,10 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
this.log.error("Server::getConfiguration error ConnectException " + e);
return Error.Type.NETWORK_ISSUE;
}
catch (UnknownHostException e) {
this.log.error("Server::getConfiguration: exception UnknownHostException " + e);
return Error.Type.NETWORK_ISSUE;
}
catch (UnsupportedEncodingException e) {
this.log.error("Server::getConfiguration: exception UnsupportedEncodingException " + e);
return Error.Type.UNKNOWN;
@@ -504,6 +509,9 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
catch (NoRouteToHostException e) {
throw new FermeServerDown();
}
catch (UnknownHostException e) {
throw new FermeServerDown();
}
catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);