Sha256: b2dced4170cec65b93b8edd4292c4d5dc07ab2c75806f58606ff2c145ff4928e

Contents?: true

Size: 777 Bytes

Versions: 2

Compression:

Stored size: 777 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['sinatra.error']
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
airbrake-3.1.8 lib/airbrake/sinatra.rb
airbrake-3.1.7 lib/airbrake/sinatra.rb