Skip to content

Commit b6dee71

Browse files
author
alexsa
committed
Improve exception handling
1 parent 46b1fec commit b6dee71

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

core/src/main/java/com/datastax/oss/driver/internal/core/ContactPoints.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static Set<EndPoint> merge(
4343
try {
4444
addresses = AddressUtils.extract(spec, resolve);
4545
} catch (RuntimeException e) {
46-
LOG.warn("Ignoring invalid contact point {} ({})", spec, e.getMessage());
46+
LOG.warn("Ignoring invalid contact point {} ({})", spec, e.getMessage(), e);
4747
}
4848

4949
if (addresses.size() > 1) {

core/src/main/java/com/datastax/oss/driver/internal/core/addresstranslation/SubnetAddressTranslator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ public String getPath() {
107107
};
108108

109109
private final List<SubnetAddress> subnetAddresses;
110+
110111
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
111112
private final Optional<InetSocketAddress> defaultAddress;
113+
112114
private final String logPrefix;
113115

114116
public SubnetAddressTranslator(@NonNull DriverContext context) {
@@ -172,7 +174,7 @@ private InetSocketAddress parseAddress(String address, boolean resolve) {
172174
return parsedAddress;
173175
} catch (RuntimeException e) {
174176
throw new IllegalArgumentException(
175-
String.format("Invalid address %s (%s)", address, e.getMessage()));
177+
String.format("Invalid address %s (%s)", address, e.getMessage()), e);
176178
}
177179
}
178180

core/src/main/java/com/datastax/oss/driver/internal/core/util/AddressUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static Set<InetSocketAddress> extract(String address, boolean resolve) {
4747
try {
4848
inetAddresses = InetAddress.getAllByName(host);
4949
} catch (UnknownHostException e) {
50-
throw new RuntimeException("unknown host " + host, e);
50+
throw new RuntimeException(e);
5151
}
5252
Set<InetSocketAddress> result = new HashSet<>();
5353
for (InetAddress inetAddress : inetAddresses) {

0 commit comments

Comments
 (0)