Sha256: b39e3702e6bb636dd76d400b0678c1b996b48a50ecd90ecc3385d7fe3326fe1f

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

module Erorr
  module Middleware
    class Rack
      def initialize(app)
        @app = app
      end

      def call(env)
        begin
          response = @app.call(env)
        rescue Exception => exception
          request = ActionDispatch::Request.new env

          location = request.parameters.values_at('controller', 'action').join('#')
          request_params = {
            params: request.parameters,
            remote_ip: request.remote_ip,
          }

          Erorr.notify exception, location: location, request: request_params

          raise
        end

        response
      ensure
        # Erorr.clear_request_data
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
erorr-0.1.1 lib/erorr/middleware/rack.rb
erorr-0.1.0 lib/erorr/middleware/rack.rb