|
|
|
@ -17,6 +17,7 @@
|
|
|
|
|
package org.springframework.boot.buildpack.platform.docker.transport;
|
|
|
|
|
|
|
|
|
|
import org.springframework.util.Assert;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Exception thrown when connection to the Docker daemon fails.
|
|
|
|
@ -33,11 +34,11 @@ public class DockerConnectionException extends RuntimeException {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String buildMessage(String host, Exception cause) {
|
|
|
|
|
Assert.notNull(host, "host must not be null");
|
|
|
|
|
Assert.notNull(cause, "cause must not be null");
|
|
|
|
|
Assert.notNull(host, "Host must not be null");
|
|
|
|
|
Assert.notNull(cause, "Cause must not be null");
|
|
|
|
|
StringBuilder message = new StringBuilder("Connection to the Docker daemon at '" + host + "' failed");
|
|
|
|
|
String causeMessage = getCauseMessage(cause);
|
|
|
|
|
if (causeMessage != null && !causeMessage.isEmpty()) {
|
|
|
|
|
if (StringUtils.hasText(causeMessage)) {
|
|
|
|
|
message.append(" with error \"").append(causeMessage).append("\"");
|
|
|
|
|
}
|
|
|
|
|
message.append("; ensure the Docker daemon is running and accessible");
|
|
|
|
@ -48,7 +49,6 @@ public class DockerConnectionException extends RuntimeException {
|
|
|
|
|
if (cause.getCause() != null && cause.getCause().getClass().getName().equals(JNA_EXCEPTION_CLASS_NAME)) {
|
|
|
|
|
return cause.getCause().getMessage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return cause.getMessage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|