On Feb 17, 7:36 am, Avdi Grimm <gro...@inbox.avdi.org> wrote:
> On Wed, Feb 16, 2011 at 7:24 AM, Yuriy Naidyon <yuro...@gmail.com> wrote:
> > def some_action
> >   raise Exception if some_falsy_value
> > rescue
> >   @message = 'Error'
> > end
>
> Don't raise Exception. Raise some descendant of StandardError, like
> RuntimeError (the default if you don't specify a class) or (even
> better) your own StandardError-derived exception class.
>
> A straight-up exception will bypass all default "rescue" clauses and
> in general indicates that something has gone badly wrong and the
> program should end.
>
> --
> Avdi Grimmhttp://avdi.org
> _______________________________________________
> rspec-users mailing list
> rspec-us...@rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users

"A straight-up exception will bypass all default "rescue" clauses" - I
learn something everyday!
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to