提交 c9891608 编写于 作者: D Dylan Smith

Avoid unnecessary catching of Exception instead of StandardError.

上级 7381968c
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册