5

What's the best way to catch all network related problems?

The exception is handled some layers above (it can be thrown from various places, and that's the right place to handle it) and I obviously don't want to catch it as a generic exception, because that could mask other problems.

I hope somebody encountered this problem before. This is my current list (but I fear it's not complete):

rescue Timeout::Error, Net::HTTPServerException, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, Errno::ENETUNREACH, Errno::ETIMEDOUT
Karoly Horvath
  • 94,607
  • 11
  • 117
  • 176
  • Just a first step, but `SystemCallError` takes all `Errno` exceptions. But you may not want to catch all `Errno` either... – tokland Sep 19 '12 at 12:09
  • 1
    Also related: http://stackoverflow.com/questions/5370697/whats-the-best-way-to-handle-exceptions-from-nethttp – pje Mar 04 '13 at 21:03

0 Answers0