Sha256: 3c5136f52a24e53fe50bf48b5a684097918c549610b06cac977c6442d7439a56

Contents?: true

Size: 779 Bytes

Versions: 4

Compression:

Stored size: 779 Bytes

Contents

module Airbrake
  # Middleware for Sinatra applications. Any errors raised by the upstream
  # application will be delivered to Airbrake and re-raised.

  # Synopsis:

  #   require 'sinatra'
  #   require 'airbrake'

  #   Airbrake.configure do |config|
  #     config.api_key = 'my api key'
  #   end

  #   use Airbrake::Sinatra

  #   get '/' do
  #     raise "Sinatra has left the building"
  #   end
  #
  # Use a standard Airbrake.configure call to configure your api key.
  class Sinatra < Rack

    def initialize(app)
      super
      Airbrake.configuration.environment_name = "#{app.settings.environment}"
      Airbrake.configuration.framework = "Sinatra: #{::Sinatra::VERSION}"
    end

    def framework_exception(env)
      env['sinatra.error']
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
airbrake-3.1.12 lib/airbrake/sinatra.rb
airbrake-3.1.11 lib/airbrake/sinatra.rb
airbrake-3.1.10 lib/airbrake/sinatra.rb
airbrake-3.1.9 lib/airbrake/sinatra.rb