Merge 16110:16487 from trunk.
[rails.git] / config / initializers / abstract_adapter.rb
1 module ActiveRecord
2   module ConnectionAdapters
3     class AbstractAdapter
4     protected
5       alias_method :old_log, :log
6
7       def log(sql, name)
8         if block_given?
9           old_log(sql, name) do
10             yield
11           end
12         else
13           old_log(sql, name)
14         end
15       rescue ActiveRecord::StatementInvalid => ex
16         if ex.message =~ /^OSM::APITimeoutError: /
17           raise OSM::APITimeoutError.new
18         else
19           raise
20         end
21       end
22     end
23   end
24 end