Class: Airbrake::Sinatra

Inherits:
Rack
  • Object
show all
Defined in:
lib/airbrake/sinatra.rb

Overview

get ‘/’ do

  raise "Sinatra has left the building"
end

Use a standard Airbrake.configure call to configure your api key.

Instance Method Summary collapse

Methods inherited from Rack

#call, #ignored_user_agent?, #notify_airbrake

Constructor Details

#initialize(app) ⇒ Sinatra

Returns a new instance of Sinatra.



23
24
25
26
27
# File 'lib/airbrake/sinatra.rb', line 23

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

Instance Method Details

#environment_name(app) ⇒ Object



33
34
35
36
37
38
# File 'lib/airbrake/sinatra.rb', line 33

def environment_name(app)
  "#{app.settings.environment}"
rescue
  ENV["RACK_ENV"] || warn("[Airbrake] Couldn't determine environment name automatically. "\
    "Please set your environment name manually by setting 'config.environment_name='.")
end

#framework_exception(env) ⇒ Object



29
30
31
# File 'lib/airbrake/sinatra.rb', line 29

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