groovy-wslite
groovy-wslite copied to clipboard
RESTClientException triggered from UnkownHostException doesn't tell what's wrong
When executing a REST operation with a wrong hostname, RESTClientException only delivers the hostname, whithout giving any hint as to what's wrong with that host, for example:
try {
def client = new RESTClient('http://non-existing.example.com')
def response = client.get(path: '/something', accept: ContentType.JSON) {
type ContentType.JSON
}
}
catch (RESTClientException rce) {
println(rce.message)
}
will only print non-existing.example.com
. A more complete message like
Unknown host: non-existing.example.com
would make it more clear what the problem with this host is. One needs to catch java.net.UnknownHostException
, though.
This is from version 1.1.3