Skip to content

Commit 2d69532

Browse files
authored
Add available error information to UnknownHostException (dnsjava#154)
* Add available error information to UnknownHostException Closes dnsjava#149
1 parent 5c0209c commit 2d69532

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/java/org/xbill/DNS/Address.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ private static Record[] lookupHostName(String name, boolean all) throws UnknownH
267267
return aaaa;
268268
}
269269
}
270-
throw new UnknownHostException("<" + name + "> could not be resolved");
270+
throw new UnknownHostException(
271+
"<" + name + "> could not be resolved: " + lookup.getErrorString());
271272
}
272273
if (!all) {
273274
return a;
@@ -281,7 +282,7 @@ private static Record[] lookupHostName(String name, boolean all) throws UnknownH
281282
System.arraycopy(aaaa, 0, merged, a.length, aaaa.length);
282283
return merged;
283284
} catch (TextParseException e) {
284-
throw new UnknownHostException("<" + name + "> is invalid");
285+
throw new UnknownHostException("<" + name + "> is invalid: " + e.getMessage());
285286
}
286287
}
287288

0 commit comments

Comments
 (0)