From: Joel VanderWerf Date: 2005-09-15T14:57:22+09:00 Subject: classifying exceptions There are many places in my code that need to catch any error generated by a network system call, but I don't want to catch everything that inherits from SystemCallError. This is my current code: ALL_NETWORK_ERRORS = [Errno::ECONNRESET, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::EPIPE, IOError, Errno::ETIMEDOUT] ALL_NETWORK_ERRORS << Errno::EPROTO if defined?(Errno::EPROTO) # this doesn't exist on mswin32 begin raise Errno::ECONNREFUSED rescue *ALL_NETWORK_ERRORS puts "OK!" end Now, here's another option, but is there anything wrong with it? module NetworkRaisable; end class Errno::EPROTO; include NetworkRaisable; end class Errno::ECONNREFUSED; include NetworkRaisable; end # and so on begin raise Errno::ECONNREFUSED rescue NetworkRaisable puts "OK!" end -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407