]> git.openstreetmap.org Git - rails.git/blob - config/initializers/abstract_adapter.rb
Removed user checks from to_xml_node, as these should already be
[rails.git] / config / initializers / abstract_adapter.rb
1 if defined?(ActiveRecord::ConnectionAdaptors::AbstractAdapter)
2   module ActiveRecord
3     module ConnectionAdapters
4       class AbstractAdapter
5       protected
6         alias_method :old_log, :log
7   
8         def log(sql, name)
9           if block_given?
10             old_log(sql, name) do
11               yield
12             end
13           else
14             old_log(sql, name)
15           end
16         rescue ActiveRecord::StatementInvalid => ex
17           if ex.message =~ /^OSM::APITimeoutError: /
18             raise OSM::APITimeoutError.new
19           elsif ex.message =~ /^Timeout::Error: /
20             raise Timeout::Error.new("time's up!")
21           else
22             raise
23           end
24         end
25       end
26     end
27   end
28 end