Browse files

Merge pull request #6759 from dylanahsmith/only-catch-standard-error

Avoid unnecessary catching of Exception instead of StandardError.
  • Loading branch information...
2 parents ebe9679 + c989160 commit 625c4959573c608140005425ff709422b35ba6a3 @spastorino spastorino committed Jun 17, 2012
View
4 activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
@@ -370,7 +370,7 @@ def rollback_transaction_records(rollback)
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 @@ def commit_transaction_records
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
View
2 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -286,7 +286,7 @@ def log(sql, name = "SQL", binds = [])
: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)
View
6 activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -264,19 +264,19 @@ def update_sql(sql, name = nil) #:nodoc:
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
View
2 activesupport/lib/active_support/log_subscriber.rb
@@ -92,7 +92,7 @@ def call(message, *args)
method = message.split('.').first
begin
send(method, ActiveSupport::Notifications::Event.new(message, *args))
- rescue Exception => e
+ rescue => e
logger.error "Could not log #{message.inspect} event. #{e.class}: #{e.message} #{e.backtrace}"
end
end
View
2 activesupport/lib/active_support/multibyte/unicode.rb
@@ -331,7 +331,7 @@ def #{attr_name} # def codepoints
def load
begin
@codepoints, @composition_exclusion, @composition_map, @boundary, @cp1252 = File.open(self.class.filename, 'rb') { |f| Marshal.load f.read }
- rescue Exception => e
+ rescue => e
raise IOError.new("Couldn't load the Unicode tables for UTF8Handler (#{e.message}), ActiveSupport::Multibyte is unusable")
end

0 comments on commit 625c495

Please sign in to comment.