From: Robert Klemme Date: 2004-07-02T23:32:47+09:00 Subject: Re: Exceptions list - Unix ENOENT not the name of the exception - what is? "Austin Ziegler" schrieb im Newsbeitrag news:9e7db91104070206039eee67a@mail.gmail.com... > On Fri, 2 Jul 2004 21:48:45 +0900, Dick Davies > wrote: > > > Out of interest, is there anyway of knowing what exceptions a given > > class can raise? > > > > I'd expect not, but I've been wrong before (as any regulars on this list > > will know). > > As far as I know, no. However, I have also read that the "promised" > list of exceptions (cf Java) is more problematic than useful (ISTR > something on Joel on Software about it). However, using the classtree > method (http://www.rubygarden.org/ruby?ASCIIClassHierarchyGenerator), > you can call: > > class_tree(Exception, false, false) > > And get a tree of possible exceptions. That's where I found Errno::ENOENT. In this case catching Exception should have helped, too. Or am I missing something? begin File.open("not possibly found here") rescue Exception => e p e puts e.class end Yields this in IRB: irb(main):001:0> begin irb(main):002:1* File.open("not possibly found here") irb(main):003:1> rescue Exception => e irb(main):004:1> p e irb(main):005:1> puts e.class irb(main):006:1> end # Errno::ENOENT => nil Regards robert