Sha256: 9430445d941408e1ce6c5dc5e75e3ea9572148971057aafb79c0abd5ef4831d1

Contents?: true

Size: 843 Bytes

Versions: 10

Compression:

Stored size: 843 Bytes

Contents

module Ratchetio
  module Rails
    module Middleware
      module ExceptionCatcher
        def self.included(base)
          base.send(:alias_method_chain, :render_exception, :ratchetio)
        end

        def render_exception_with_ratchetio(env, exception)
          begin
            controller = env['action_controller.instance']
            request_data = controller.try(:ratchetio_request_data)
            person_data = controller.try(:ratchetio_person_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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ratchetio-0.5.0 lib/ratchetio/rails/middleware/exception_catcher.rb
ratchetio-0.4.11 lib/ratchetio/rails/middleware/exception_catcher.rb
ratchetio-0.4.10 lib/ratchetio/rails/middleware/exception_catcher.rb
ratchetio-0.4.9 lib/ratchetio/rails/middleware/exception_catcher.rb
ratchetio-0.4.8 lib/ratchetio/rails/middleware/exception_catcher.rb
ratchetio-0.4.7 lib/ratchetio/rails/middleware/exception_catcher.rb
ratchetio-0.4.6 lib/ratchetio/rails/middleware/exception_catcher.rb
ratchetio-0.4.5 lib/ratchetio/rails/middleware/exception_catcher.rb
ratchetio-0.4.4 lib/ratchetio/rails/middleware/exception_catcher.rb
ratchetio-0.4.3 lib/ratchetio/rails/middleware/exception_catcher.rb