source: subversion/sites/rails_port/config/initializers/abstract_adapter.rb @ 15161

Last change on this file since 15161 was 15159, checked in by tomhughes, 10 years ago

Check for wrapped timeout errors properly.

File size: 501 bytes
Line 
1module 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
24end
Note: See TracBrowser for help on using the repository browser.