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 Grimm
http://avdi.org
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to