Module: CrashdeskRails::DebugExceptions

Defined in:
lib/crashdesk-rails/debug_exceptions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/crashdesk-rails/debug_exceptions.rb', line 4

def self.included(base)
  base.send(:alias_method_chain, :render_exception, :crashdesk)
end

Instance Method Details

#render_exception_with_crashdesk(env, exception) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/crashdesk-rails/debug_exceptions.rb', line 8

def render_exception_with_crashdesk(env, exception)
  request = Rack::Request.new(env)
  context = ActionControllerContext.new(env['action_controller.instance'], request)

  begin
    crashlog = Crashdesk.crashlog(exception, request, context)
    crashlog.report
  rescue Exception => e
    $stderr.puts "Crashdesk gem can has a bug: #{e.message}"
  end

  render_exception_without_crashdesk(env, exception)
end