Sha256: b10c9844c8464c524d68d22d7e0a22a4d57f4c7f071c8395224615c4d62cfe6c
Contents?: true
Size: 1006 Bytes
Versions: 12
Compression:
Stored size: 1006 Bytes
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 # use Airbrake::Rack # run lambda { |env| raise "Rack down" } # end # # Use a standard Airbrake.configure call to configure your api key. class Rack def initialize(app) @app = app 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
12 entries across 12 versions & 1 rubygems