Sha256: 5853ab33d665ef5f84e9c73a42975d20fd5d188369f6eb197f083344208ebd7c

Contents?: true

Size: 1 KB

Versions: 22

Compression:

Stored size: 1 KB

Contents

module Goalie
  class CustomErrorPages
    alias_method :orig_render_exception, :render_exception
    
    private

    def render_exception(env, exception)
      exception_data = nil
      begin
        controller = env['action_controller.instance']
        request_data = controller.try(:rollbar_request_data)
        person_data = controller.try(:rollbar_person_data)
        exception_data = Rollbar.report_exception(exception, request_data, person_data)
      rescue => e
        # TODO use logger here?
        puts "[Rollbar] Exception while reporting exception to Rollbar: #{e}" 
      end
      
      # if an exception was reported, save uuid in the env
      # so it can be displayed to the user on the error page
      if exception_data
        begin
          env['rollbar.exception_uuid'] = exception_data[:uuid]
        rescue => e
          puts "[Rollbar] Exception saving uuid in env: #{e}"
        end
      end

      # now continue as normal
      orig_render_exception(env, exception)
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rollbar-0.10.3 lib/rollbar/goalie.rb
rollbar-0.10.2 lib/rollbar/goalie.rb
rollbar-0.10.1 lib/rollbar/goalie.rb
rollbar-0.10.0 lib/rollbar/goalie.rb
rollbar-0.9.14 lib/rollbar/goalie.rb
rollbar-0.9.13 lib/rollbar/goalie.rb
rollbar-0.9.12 lib/rollbar/goalie.rb
rollbar-0.9.11 lib/rollbar/goalie.rb
rollbar-0.9.10 lib/rollbar/goalie.rb
rollbar-0.9.9 lib/rollbar/goalie.rb
rollbar-0.9.8 lib/rollbar/goalie.rb
rollbar-0.9.7 lib/rollbar/goalie.rb
rollbar-0.9.6 lib/rollbar/goalie.rb
rollbar-0.9.4 lib/rollbar/goalie.rb
rollbar-0.9.3 lib/rollbar/goalie.rb
rollbar-0.9.2 lib/rollbar/goalie.rb
rollbar-0.9.1 lib/rollbar/goalie.rb
rollbar-0.9.0 lib/rollbar/goalie.rb
rollbar-0.8.3 lib/rollbar/goalie.rb
rollbar-0.8.2 lib/rollbar/goalie.rb