ActiveRecord exception handling


I'm writing some scripts on the command line using ActiveRecord, and
some interesting (read: confusing) things are happening with the way
exceptions are caught and re-raised.

In AbstractAdapter.log (connection_adapters/abstract_adapter.rb:144),
Exception is rescued and reraised as an ActiveRecord::StatementInvalid
exception. While in most cases I'm sure this is fine, Exception
includes things like SystemExit and SignalException, which have
nothing to do with invalid SQL. If I'm executing a statement when I
send a TERM signal to the process (or call exit(0) when I trap it), if
I catch StatementInvalid and deal with it somehow my script is going
to continue running.

I just noticed in r8484 the other thing I was going to mention ('TERM'
being trapped in transactions.rb) was fixed; that produced similar

Even changing Exception to StandardException inside
AbstractAdapter.log would solve most of what I'm seeing. Does anyone
have any thoughts on this?



StandardError, rather, not StandardException.