Class: Rack::BugzScout

Inherits:
Object
  • Object
show all
Defined in:
lib/rack_bugzscout.rb

Overview

Catches all exceptions raised, and submits them to FogBugz via BugzScout.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, fogbugz_url, fogbugz_user, fogbugz_project = 'inbox', fogbugz_area = 'undecided') ⇒ BugzScout

Returns a new instance of BugzScout.



11
12
13
14
15
16
17
18
19
# File 'lib/rack_bugzscout.rb', line 11

def initialize(app,fogbugz_url,fogbugz_user,fogbugz_project='inbox',fogbugz_area='undecided')
  @app = app
  @fogbugz_url = fogbugz_url
  @fogbugz_user = fogbugz_user
  @fogbugz_project = fogbugz_project
  @fogbugz_area = fogbugz_area
  
  @template = ERB.new(TEMPLATE)
end

Instance Attribute Details

#fogbugz_areaObject (readonly)

Returns the value of attribute fogbugz_area.



9
10
11
# File 'lib/rack_bugzscout.rb', line 9

def fogbugz_area
  @fogbugz_area
end

#fogbugz_projectObject (readonly)

Returns the value of attribute fogbugz_project.



9
10
11
# File 'lib/rack_bugzscout.rb', line 9

def fogbugz_project
  @fogbugz_project
end

#fogbugz_urlObject (readonly)

Returns the value of attribute fogbugz_url.



9
10
11
# File 'lib/rack_bugzscout.rb', line 9

def fogbugz_url
  @fogbugz_url
end

#fogbugz_userObject (readonly)

Returns the value of attribute fogbugz_user.



9
10
11
# File 'lib/rack_bugzscout.rb', line 9

def fogbugz_user
  @fogbugz_user
end

Instance Method Details

#call(env) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rack_bugzscout.rb', line 21

def call(env)
  status, headers, body =
    begin
      @app.call(env)
    rescue => boom
      send_notification boom, env
      raise
    end
  send_notification env['rack.exception'], env if env['rack.exception']
  [status, headers, body]
end