groovy-wslite icon indicating copy to clipboard operation
groovy-wslite copied to clipboard

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

Open dhs-rec opened this issue 4 years ago • 0 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

dhs-rec avatar May 13 '20 07:05 dhs-rec