Class: Rnotifier::RackMiddleware
- Inherits:
-
Object
- Object
- Rnotifier::RackMiddleware
- Defined in:
- lib/rnotifier/rack_middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, config_file = nil) ⇒ RackMiddleware
constructor
A new instance of RackMiddleware.
Constructor Details
#initialize(app, config_file = nil) ⇒ RackMiddleware
Returns a new instance of RackMiddleware.
4 5 6 7 |
# File 'lib/rnotifier/rack_middleware.rb', line 4 def initialize(app, config_file = nil) @app = app config_file ? Rnotifier.load_config(config_file) : Rnotifier.config end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rnotifier/rack_middleware.rb', line 9 def call(env) begin response = @app.call(env) rescue Exception => e Rnotifier::ExceptionData.new(e, env, {:type => :rack}).notify env['rnotifier.notify'] = true raise e end if e = (env['rack.exception'] || env['sinatra.error']) Rnotifier::ExceptionData.new(e, env, {:type => :rack}).notify env['rnotifier.notify'] = true end response end |