From: Stefano Crocco Date: 2008-07-20T23:40:44+09:00 Subject: Re: Does "rescue" wihtour argument handle any kind of Exception or not? On Sunday 20 July 2008, IƱaki Baz Castillo wrote: > Hi, I read in this article: > http://jerith.livejournal.com/40063.html > that: > > --------------------------- > Exception > - StandardError > - RuntimeError > - ZeroDivisionError > - ScriptError > - SyntaxError > - SystemExit > - SignalException > - Interrupt > > The important bit there is that all the stuff you can reasonably expect to > recover from is under StandardError. Because of this, a default rescue > block will not catch anything that isn't a StandardError. The observant > reader will notice that I helpfully showed Interrupt's position in the > hierarchy. The observant reader will also notice that it is not a subclass > of StandardError. This means that you need to catch it explicitly, or it > will cause a crash. --------------------------- > > But is it really true? I do: > > ---- > begin > raise Interrupt > rescue > puts "rescued !!!" > end > ---- > > And I get: > > => "rescued !!!" > > > So is the above article tru or not? > > Thanks. For me, using ruby 1.8.7, patchlevel 22 on Gentoo Linux, your code works as the article says, that is the exception is not being caught. Stefano