openstreetmap-website/config/initializers/abstract_adapter.rb
Tom Hughes f8f7054fc2 Move monkey patch modules to the OpenStreetMap namespace
Having them in the OSM namespace risks blocking autoloading
of the lib/osm.rb code by defining the OSM constant.
2017-06-02 16:33:27 +01:00

17 lines
481 B
Ruby

if defined?(ActiveRecord::ConnectionAdaptors::AbstractAdapter)
module OpenStreetMap
module AbstractAdapter
module PropagateTimeouts
def translate_exception_class(e, sql)
if e.is_a?(Timeout::Error) || e.is_a?(OSM::APITimeoutError)
e
else
super(e, sql)
end
end
end
end
end
ActiveRecord::ConnectionAdaptors::AbstractAdapter.prepend(OpenStreetMap::AbstractAdapter::PropagateTimeouts)
end