Class: RackHoptoadNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/rack-hoptoad-notifier.rb,
lib/rack-hoptoad-notifier/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RackHoptoadNotifier

Returns a new instance of RackHoptoadNotifier.



5
6
7
# File 'lib/rack-hoptoad-notifier.rb', line 5

def initialize(app)
  @app = app
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



4
5
6
# File 'lib/rack-hoptoad-notifier.rb', line 4

def app
  @app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/rack-hoptoad-notifier.rb', line 9

def call(env)
  response = app.call(env)
  if env["rack.exception"]
    HoptoadNotifier.notify(env["rack.exception"])
  end
  response
rescue Exception => e
  HoptoadNotifier.notify(e)
  raise e
end