Module: Pulse::Rails::Middleware::ExceptionsCatcher
- Defined in:
- lib/pulse/rails/middleware/exceptions_catcher.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/pulse/rails/middleware/exceptions_catcher.rb', line 5 def self.included(base) base.send(:alias_method_chain,:render_exception,:pulse) end |
Instance Method Details
#render_exception_with_pulse(env, exception) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pulse/rails/middleware/exceptions_catcher.rb', line 16 def render_exception_with_pulse(env,exception) begin controller = env['action_controller.instance'] env['pulse.error_id'] = Pulse. notify_or_ignore(exception, controller.try(:pulse_request_data) || {:rack_env => env}) unless skip_user_agent?(env) if defined?(controller.rescue_action_in_public_without_pulse) controller.rescue_action_in_public_without_pulse(exception) end rescue # do nothing end render_exception_without_pulse(env,exception) end |
#skip_user_agent?(env) ⇒ Boolean
9 10 11 12 13 14 |
# File 'lib/pulse/rails/middleware/exceptions_catcher.rb', line 9 def skip_user_agent?(env) user_agent = env["HTTP_USER_AGENT"] ::Pulse.configuration.ignore_user_agent.flatten.any? { |ua| ua === user_agent } rescue false end |