diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-06-17 08:11:47 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-06-17 08:11:47 -0700 |
commit | 625c4959573c608140005425ff709422b35ba6a3 (patch) | |
tree | 9b03e2449a1c5a0235535d1f99a3e2500fae0bc5 /activerecord/lib/active_record/connection_adapters | |
parent | ebe9679d9424fbc06f6f870d9003cd20fbc130af (diff) | |
parent | c9891608aa1e5ebbab04afe73bf7a28748001804 (diff) | |
download | rails-625c4959573c608140005425ff709422b35ba6a3.tar.gz rails-625c4959573c608140005425ff709422b35ba6a3.tar.bz2 rails-625c4959573c608140005425ff709422b35ba6a3.zip |
Merge pull request #6759 from dylanahsmith/only-catch-standard-error
Avoid unnecessary catching of Exception instead of StandardError.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
3 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index 4c6d03a1d2..b0b51f540c 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -370,7 +370,7 @@ module ActiveRecord records.uniq.each do |record| begin record.rolledback!(rollback) - rescue Exception => e + rescue => e record.logger.error(e) if record.respond_to?(:logger) && record.logger end end @@ -385,7 +385,7 @@ module ActiveRecord records.uniq.each do |record| begin record.committed! - rescue Exception => e + rescue => e record.logger.error(e) if record.respond_to?(:logger) && record.logger end end diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index c6faae77cc..28a9821913 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -286,7 +286,7 @@ module ActiveRecord :name => name, :connection_id => object_id, :binds => binds) { yield } - rescue Exception => e + rescue => e message = "#{e.class.name}: #{e.message}: #{sql}" @logger.error message if @logger exception = translate_exception(e, message) diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 692473abc5..921278d145 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -264,19 +264,19 @@ module ActiveRecord def begin_db_transaction execute "BEGIN" - rescue Exception + rescue # Transactions aren't supported end def commit_db_transaction #:nodoc: execute "COMMIT" - rescue Exception + rescue # Transactions aren't supported end def rollback_db_transaction #:nodoc: execute "ROLLBACK" - rescue Exception + rescue # Transactions aren't supported end |