Module: Yeller::Rails::Rails3AndFourCatchingHooks

Defined in:
lib/yeller/rails.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



79
80
81
82
# File 'lib/yeller/rails.rb', line 79

def self.included(base)
  base.send(:alias_method, :render_exception_without_yeller, :render_exception)
  base.send(:alias_method, :render_exception, :render_exception_with_yeller)
end

Instance Method Details

#_capture_exception(env, exception, extra = {}) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/yeller/rails.rb', line 84

def _capture_exception(env, exception, extra={})
  begin
    request = ::Rack::Request.new(env)
    controller = env['action_controller.instance']

    if controller
      params = controller.send(:params)
      Yeller::Rack.report(
        exception,
        :url => request.url,
        :location => "#{controller.class.to_s}##{params[:action]}",
        :custom_data => controller._yeller_custom_data.merge(extra)
      )
    else
      Yeller::VerifyLog.action_controller_instance_not_in_env!
      Yeller::Rack.rescue_rack_exception(exception, env)
    end
  rescue => e
    Yeller::VerifyLog.error_reporting_rails_error!(e)
  end
end

#render_exception_with_yeller(env, exception) ⇒ Object



110
111
112
113
114
# File 'lib/yeller/rails.rb', line 110

def render_exception_with_yeller(env, exception)
  Yeller::VerifyLog.render_exception_with_yeller!
  _capture_exception(env, exception)
  render_exception_without_yeller(env, exception)
end

#report_exception_to_yeller(exception, extra = {}) ⇒ Object



106
107
108
# File 'lib/yeller/rails.rb', line 106

def report_exception_to_yeller(exception, extra={})
  _capture_exception(request.env, exception, extra)
end