Skip to content

Commit

Permalink
Better error when DOCKER_HOST invalid
Browse files Browse the repository at this point in the history
At the moment something like DOCKER_HOST=foo results in an IAE and startup failing.
  • Loading branch information
stuartwdouglas committed Apr 20, 2022
1 parent 122467f commit 6e50b03
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public Result get() {
Object dockerClientFactoryInstance = dockerClientFactoryClass.getMethod("instance").invoke(null);
boolean isAvailable = (boolean) dockerClientFactoryClass.getMethod("isDockerAvailable")
.invoke(dockerClientFactoryInstance);
if (!isAvailable) {
compressor.closeAndDumpCaptured();
}
return isAvailable ? Result.AVAILABLE : Result.UNAVAILABLE;
} catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
if (!silent) {
Expand Down Expand Up @@ -117,7 +120,7 @@ public Result get() {
"Unable to connect to DOCKER_HOST URI %s, make sure docker is running on the specified host",
dockerHost);
}
} catch (URISyntaxException e) {
} catch (URISyntaxException | IllegalArgumentException e) {
LOGGER.warnf("Unable to parse DOCKER_HOST URI %s, it will be ignored for working docker detection",
dockerHost);
}
Expand Down

0 comments on commit 6e50b03

Please sign in to comment.