Module: Errplane::Rails::Middleware::HijackRenderException

Defined in:
lib/errplane/rails/middleware/hijack_render_exception.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
# File 'lib/errplane/rails/middleware/hijack_render_exception.rb', line 5

def self.included(base)
  ::Rails.logger.info("INSTALLING MIDDLEWARE 1")
  base.send(:alias_method_chain, :render_exception, :errplane)
  ::Rails.logger.info base.inspect
  ::Rails.logger.info("DONE 1")
end

Instance Method Details

#render_exception_with_errplane(env, e) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/errplane/rails/middleware/hijack_render_exception.rb', line 12

def render_exception_with_errplane(env, e)
  ::Rails.logger.info("MIDDLEWARE 1 IS GETTING CALLED")
  controller = env["action_controller.instance"]
  request_data = controller.try(:errplane_request_data) || {}
  unless Errplane.configuration.ignore_user_agent?(request_data[:user_agent])
    Errplane.report_exception_unless_ignorable(e, request_data)
  end
  render_exception_without_errplane(env, e)
end