[rspec-users] Question on SQL exceptions

James Byrne lists at ruby-forum.com
Mon Mar 9 19:31:03 EDT 2009

Tim Glen wrote:

> Just a stab in the dark, but I haven't seen any mention of calling
> save vs. save!. save just puts any errors in the model, save! will
> raise the exception if there are any errors. That may not be the case
> for ActiveRecord:StatementInvalid exception, but I thought i'd mention
> it anyway.
> timg

I wondered about this but I think that since the DBMS exception is not 
being trapped at all that it makes no difference. However, I will check 
if if it does or not anyway.


Scott Taylor wrote:

> You can try "rescue Exception" which rescues from all exceptions, not
> just ones which inherit from StandardError.  

  Tried that one and it did not work either.

> Also - I believe this only works in 1.8.6 and above, so if you're
> still on 1.8.5 I'd recommend an upgrade.

This may be the case.  The target host runs CentOS-5.3 which ships with 
Ruby-1.8.5.  I will see if I get different results on a 1.8.6 machine.
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list