Sha256: 76318843168088c2fcd5efd6d43d76a0f3322c6aa8d0e66d46ab082254b21847

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 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(:ratchetio_request_data)
        person_data = controller.try(:ratchetio_person_data)
        exception_data = Ratchetio.report_exception(exception, request_data, person_data)
      rescue => e
        # TODO use logger here?
        puts "[Ratchet.io] Exception while reporting exception to Ratchet.io: #{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['ratchetio.exception_uuid'] = exception_data[:uuid]
        rescue => e
          puts "[Ratchet.io] Exception saving uuid in env: #{e}"
        end
      end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ratchetio-0.7.1 lib/ratchetio/goalie.rb
ratchetio-0.7.0 lib/ratchetio/goalie.rb
ratchetio-0.6.3 lib/ratchetio/goalie.rb
ratchetio-0.6.1 lib/ratchetio/goalie.rb
ratchetio-0.6.0 lib/ratchetio/goalie.rb
ratchetio-0.5.5 lib/ratchetio/goalie.rb
ratchetio-0.5.3 lib/ratchetio/goalie.rb
ratchetio-0.5.2 lib/ratchetio/goalie.rb
ratchetio-0.5.1 lib/ratchetio/goalie.rb