Class: Croket::Rails::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/croket/rails/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



13
14
15
# File 'lib/croket/rails/middleware.rb', line 13

def initialize app
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/croket/rails/middleware.rb', line 17

def call env
  begin
    response = @app.call env
  rescue Exception => e
    notify_croket env, e
    raise e
  end
  if framework_exception = env["action_dispatch.exception"]
    notify_croket env, framework_exception
  end
  #p env["rack.errors"], env["action_dispatch.show_exceptions"], env["action_dispatch.show_detailed_exceptions"]
  p env.keys.select {|i| i.include? 'exception' or i.include? 'err'}
  response
end