From: Paul Brannan Date: 2001-12-07T00:30:56+09:00 Subject: [ruby-talk:27693] Re: Controlling the error messages of eval. On Fri, Dec 07, 2001 at 12:13:06AM +0900, Phlip wrote: > 'rescue' is really 'rescue Exception', and Exception is not the root > throwable. It derives from the root throwable class and then gets thrown > for runtime errors, including syntax errors but not including things like > signals. 'rescue' is actually 'rescue StandardError'; if you use 'rescue Exception', then you will also catch ScriptError, Interrupt and some others (which is generally not desirable). The root throwable (from a Ruby script, since I think you can break the rules from an extension) is Exception (eval.c:3467): if (argc > 0) { if (!rb_obj_is_kind_of(mesg, rb_eException)) rb_raise(rb_eTypeError, "exception object expected"); set_backtrace(mesg, (argc>2)?argv[2]:Qnil); } > More important style wise, if I were your programmer-user, I want my system > to drop dead at the first error. If it "recovers" and continues I might not > notice the error message, because it might be high above a console full of > output. This isn't always desirable. As a user, I may want to be able to manually clean things up when an exception occurs. Or, it may be that I forgot to catch an expected exception, and the exception is not a real problem. However, dropping dead could be a real problem; an IRC bot, for example, is more useful disabled but connected than it is if it is dead due to an exception. Paul