From: Robert Klemme Date: 2005-11-03T02:57:08+09:00 Subject: Re: Trapping errors. Hugh Sasse wrote: > On Thu, 3 Nov 2005, Robert Klemme wrote: > >> Hugh Sasse wrote: >>> I see my changes to fileutils are now in the Ruby CVS. >>> However, even with >>> rescue Exception, SystemCallError => e >>> or >>> rescue Exception, Errno::EACCES, Errno::EBUSY => e >>> >>> I still cannot trap this error. From the call stack this part of >>> the code is being used, so why won't the error cause ruby to go back >>> up the callstack until it finds this rescue clause? >> >> Maybe there's another rescue clause that is closer to the place >> where the exception is thrown... > > But unless I have completely misunderstood the point of rescue, even > if that calls raise, the exception will still be caught by my > enclosing rescue. But who guarantees that the other rescue clause actually throws again? If it doesn't you can't catch it. .... rescue Exception => e puts "Catch me if you can >:-}" end ;-) Cheers robert