jwagenleitner / groovy-wslite

Lightweight SOAP and REST webservice clients for Groovy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RESTClientException triggered from UnkownHostException doesn't tell what's wrong

dhs-rec opened this issue · comments

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