Sha256: 2001e8e653fbda79d1e29acc321d76d3441e2ff359a01aa7687ccff5d194581f

Contents?: true

Size: 894 Bytes

Versions: 5

Compression:

Stored size: 894 Bytes

Contents

module Ratchetio
  module ExceptionReporter
    include RequestDataExtractor

    def report_exception_to_ratchetio(env, exception)
      ratchetio_debug "[Ratchet.io] Reporting exception: #{exception.try(:message)}", :error
      request_data = extract_request_data_from_rack(env)
      person_data = extract_person_data_from_controller(env)
      exception_data = Ratchetio.report_exception(exception, request_data, person_data)
      env['ratchetio.exception_uuid'] = exception_data[:uuid]
      ratchetio_debug "[Ratchet.io] Exception uuid saved in env: #{exception_data[:uuid]}"
    rescue => e
      ratchetio_debug "[Ratchet.io] Exception while reporting exception to Ratchet.io: #{e.try(:message)}"
    end

    def ratchetio_debug(message, level = :debug)
      if defined?(Rails)
        ::Rails.logger.send(level, message)
      else
        puts message
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ratchetio-0.7.1 lib/ratchetio/exception_reporter.rb
ratchetio-0.7.0 lib/ratchetio/exception_reporter.rb
ratchetio-0.6.3 lib/ratchetio/exception_reporter.rb
ratchetio-0.6.1 lib/ratchetio/exception_reporter.rb
ratchetio-0.6.0 lib/ratchetio/exception_reporter.rb