lib/raven/rack.rb in sentry-raven-0.4.5 vs lib/raven/rack.rb in sentry-raven-0.4.6
- old
+ new
@@ -16,31 +16,45 @@
# run lambda { |env| raise "Rack down" }
# end
#
# Use a standard Raven.configure call to configure your server credentials.
class Rack
+ def self.capture_exception(exception, env, options = {})
+ Raven.capture_exception(exception, options) do |evt|
+ evt.interface :http do |int|
+ int.from_rack(env)
+ end
+ end
+ end
+
+ def self.capture_message(message, env, options = {})
+ Raven.capture_message(message, options) do |evt|
+ evt.interface :http do |int|
+ int.from_rack(env)
+ end
+ end
+ end
+
def initialize(app)
@app = app
end
def call(env)
begin
response = @app.call(env)
rescue Error => e
raise # Don't capture Raven errors
rescue Exception => e
- evt = Event.capture_rack_exception(e, env)
- Raven.send(evt)
+ Raven::Rack.capture_exception(e, env)
raise
ensure
Context.clear!
end
error = env['rack.exception'] || env['sinatra.error']
if error
- evt = Event.capture_rack_exception(error, env)
- Raven.send(evt) if evt
+ Raven::Rack.capture_exception(error, env)
end
response
end
end