lib/raven/integrations/rack-timeout.rb in sentry-raven-2.7.1 vs lib/raven/integrations/rack-timeout.rb in sentry-raven-2.7.2
- old
+ new
@@ -5,11 +5,15 @@
# get grouped by Sentry's UI. Simply override #raven_context in
# the exception class, and append something to the fingerprint
# that will distinguish exceptions in the way you desire.
module RackTimeoutExtensions
def raven_context
- { :fingerprint => ["{{ default }}", env["REQUEST_URI"]] }
+ # Only rack-timeout 0.3.0+ provides the request environment, but we can't
+ # gate this based on a gem version constant because rack-timeout does
+ # not provide one.
+ { :fingerprint => ["{{ default }}", env["REQUEST_URI"]] } if defined?(env)
end
end
-Rack::Timeout::Error.include RackTimeoutExtensions
-Rack::Timeout::RequestTimeoutException.include RackTimeoutExtensions
+# Include is private in Ruby 1.9
+Rack::Timeout::Error.__send__(:include, RackTimeoutExtensions)
+Rack::Timeout::RequestTimeoutException.__send__(:include, RackTimeoutExtensions)