#1749 sys::Err suberrors for webclient?

Xan Wed 11 Jan 2012

Hi,

Another time for doubt. I hope no boring you ;-) Just a question: is there an specific web client errors, like MalformedURLException or UnknownHostException in Java?

For example, I receive inet::UnknownHostErr for http://ww.io host. So UnkownHostErr exists. But there is no documentation about it, I think.

Thanks a lot, Xan.

brian Thu 12 Jan 2012

Unless there is a specific problem we think you would want to catch, we don't typically create a ton of different exceptions types. UnknownHostErr is a first class exception though - it is documented under inet::UnknownHostErr. URIs would throw ParseErr on their fromStr if they are malformed.

Xan Thu 12 Jan 2012

So, specifically, there are only UnkownHostErr and ParseErr? I want to know for caching as you said. If UnkownHostErr, then echo(Wunkown host"). If ....

Thanks a lot for fast answer. Xan.

Xan Thu 12 Jan 2012

Ah!, is there any way to see all the subclasses of sys::Err? I see this hierachy;: sys::Obj

sys::Err
  sys::IOErr
    inet::UnknownHostErr

brian Thu 12 Jan 2012

Ah!, is there any way to see all the subclasses of sys::Err?

Not in the docs, but easy to write a little program to show them all:

Void main()
{
  acc := Type[,]    
  Pod.list.each |pod| 
  {
    pod.types.each |type| { if (type.fits(Err#)) acc.add(type) }
  }
  echo(acc.sort.join("\n"))
}

Xan Fri 13 Jan 2012

Thank you very much, brian, for the code. I think you could modify the documentation for including it. Mark it as doc bug if you want to fix it in some (long) future.

Regards,

Login or Signup to reply.