Class: Rack::RailsAppygram

Inherits:
Object
  • Object
show all
Defined in:
lib/appygram-rails/integration/rack_rails.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RailsAppygram

Returns a new instance of RailsAppygram.



7
8
9
# File 'lib/appygram-rails/integration/rack_rails.rb', line 7

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/appygram-rails/integration/rack_rails.rb', line 17

def call(env)
  begin
    body = @app.call(env)
  rescue Exception => e
    handle_with_controller(e,env['action_controller.instance'], Rack::Request.new(env))
    raise
  end

  if env['rack.exception']
    handle_with_controller(env['rack.exception'],env['action_controller.instance'], Rack::Request.new(env))
  end

  body
end

#handle_with_controller(exception, controller, request) ⇒ Object



11
12
13
14
15
# File 'lib/appygram-rails/integration/rack_rails.rb', line 11

def handle_with_controller(exception, controller, request)
  unless ::AppygramRails.ignores_exception_class? exception
    ::AppygramRails::Catcher.handle_with_controller(exception, controller, request)
  end
end