Sha256: 1980c8fdb1749c89b5718dfdff494c15d7ea18bc5a8f5afe458f782ed0918423
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
module Airbrake # Middleware for Rack applications. Any errors raised by the upstream # application will be delivered to Airbrake and re-raised. # # Synopsis: # # require 'rack' # require 'airbrake' # # Airbrake.configure do |config| # config.api_key = 'my_api_key' # end # # app = Rack::Builder.app do # run lambda { |env| raise "Rack down" } # end # # use Airbrake::Rack # run app # # Use a standard Airbrake.configure call to configure your api key. class Rack def initialize(app) @app = app Airbrake.configuration.logger ||= Logger.new STDOUT end def call(env) begin response = @app.call(env) rescue Exception => raised error_id = Airbrake.notify_or_ignore(raised, :rack_env => env) env['airbrake.error_id'] = error_id raise end if env['rack.exception'] error_id = Airbrake.notify_or_ignore(env['rack.exception'], :rack_env => env) env['airbrake.error_id'] = error_id end response end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
airbrake-3.1.1 | lib/airbrake/rack.rb |
airbrake-3.1.0 | lib/airbrake/rack.rb |