avoid discarding exceptions in docker helper

This commit is contained in:
Jonathan Shook 2020-12-07 01:50:25 -06:00
parent da87b1c3bd
commit f1e3adf518
2 changed files with 11 additions and 8 deletions

View File

@ -155,7 +155,7 @@ public class DockerHelper {
logger.error("Unable to contact docker, make sure docker is up and try again.");
logger.error("If docker is installed make sure this user has access to the docker group.");
logger.error("$ sudo gpasswd -a ${USER} docker && newgrp docker");
System.exit(1);
throw e;
}
return false;
@ -178,7 +178,7 @@ public class DockerHelper {
logger.error("Unable to contact docker, make sure docker is up and try again.");
logger.error("If docker is installed make sure this user has access to the docker group.");
logger.error("$ sudo gpasswd -a ${USER} docker && newgrp docker");
System.exit(1);
throw e;
}
return false;
}
@ -193,7 +193,7 @@ public class DockerHelper {
} catch (Exception e) {
e.printStackTrace();
logger.error("Unable to contact docker, make sure docker is up and try again.");
System.exit(1);
throw e;
}
if (runningContainers.size() >= 1) {
@ -204,9 +204,10 @@ public class DockerHelper {
if (reload != null) {
try {
post(reload, null, false, "reloading config");
post(reload, null, false, "reload config");
} catch (Exception e) {
logger.error(String.format("Unexpected config/state for docker container %s, consider removing the container", name));
throw e;
}
}
@ -233,6 +234,7 @@ public class DockerHelper {
} catch (InterruptedException e) {
logger.error("Error getting docker log and detect start for containerId: " + containerId);
e.printStackTrace();
throw new RuntimeException(e);
}
}

View File

@ -228,7 +228,7 @@ public class DockerMetricsManager {
logger.error("failed to set permissions on prom backup " +
"directory " + userHome + "/.nosqlbench/prometheus)");
e.printStackTrace();
System.exit(1);
throw new RuntimeException(e);
}
try (PrintWriter out = new PrintWriter(
@ -238,11 +238,11 @@ public class DockerMetricsManager {
} catch (FileNotFoundException e) {
e.printStackTrace();
logger.error("error writing prometheus yaml file to ~/.prometheus");
System.exit(1);
throw new RuntimeException(e);
} catch (IOException e) {
e.printStackTrace();
logger.error("creating file in ~/.prometheus");
System.exit(1);
throw new RuntimeException(e);
}
}
@ -302,7 +302,7 @@ public class DockerMetricsManager {
logger.error("failed to set permissions on grafana directory " +
"directory " + userHome + "/.nosqlbench/grafana)");
e.printStackTrace();
System.exit(1);
throw new RuntimeException(e);
}
}
@ -348,6 +348,7 @@ public class DockerMetricsManager {
close();
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}