Skip to content

Commit

Permalink
GG-21710 Added processing of additional connection errors. (apache#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsisko committed Jul 31, 2019
1 parent dcc74e9 commit badca30
Showing 1 changed file with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.apache.ignite.console.agent;

import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.net.Authenticator;
Expand Down Expand Up @@ -152,12 +153,26 @@ public class AgentLauncher {
return;
}

if (X.hasCause(e, EOFException.class)) {
log.error("Failed to receive response from server (connection lost).");

return;
}

IOException ignore = X.cause(e, IOException.class);

if (ignore != null && "404".equals(ignore.getMessage())) {
log.error("Failed to receive response from server (connection refused).");
if (ignore != null) {
if ("404".equals(ignore.getMessage())) {
log.error("Failed to receive response from server (connection refused).");

return;
return;
}

if ("504".equals(ignore.getMessage())) {
log.error("Failed to receive response from server (connection timeout).");

return;
}
}

log.error("Connection error.", e);
Expand All @@ -172,10 +187,13 @@ public class AgentLauncher {

IOException ioCause = X.cause(e, IOException.class);

if (ioCause != null && "404".equals(ioCause.getMessage())) {
log.error("You are using outdated version of Web agent. Please download latest version of Web agent from Web console");
if (ioCause != null) {
if ("404".equals(ioCause.getMessage())) {
log.error("You have configured invalid server-uri property or are using outdated version of Web agent.");
log.error("Please check you configuration file or download latest version of Web agent from Web console.");

System.exit(1);
System.exit(1);
}
}

onError.call(args);
Expand Down

0 comments on commit badca30

Please sign in to comment.