From: Zach Moazeni on 15 Apr 2010 13:56 On Apr 15, 2010, at 1:31 PM, Robert Dober wrote: > I agree with most you say, but I took the habit to inherit from > RuntimeError rather than StandardError a long time ago. AAMOF I forgot > why? Does someone here recall the rationale? I'd be interested in hearing the rationale too. I actually forget my argument for using StandardError, I only remember running into issues (that I also don't remember) doing class MyError < Exception ... end I've seen smarter devs than me using StandardError, so I've been in mostly emulation mode :) -- Zach Moazeni http://simplechatter.com
From: Jonathan Nielsen on 15 Apr 2010 14:30 The problem (IIRC) with extending from Exception instead of StandardError is that a plain 'rescue' statement will not catch bare Exceptions, it catches StandardError (or is it RuntimeError?) by default. To catch Exception (or descended classes), you need to specify 'rescue Exception'. But it's a bit easier just to extend from StandardError or RuntimeError, both of which are caught by a bare rescue statement. -Jonathan Nielsen
First
|
Prev
|
Pages: 1 2 Prev: [ANN] PDF::Writer officially retired in favor of Prawn Next: Deep Clone of array? |