Sha256: 81eb26760c686b15f5b4a5eeae46434ff2d60c0ba3e8aeb2c261089f76f98214

Contents?: true

Size: 751 Bytes

Versions: 8

Compression:

Stored size: 751 Bytes

Contents

require 'fluoride-collector/middleware'
module Fluoride
  module Collector
    class Middleware
      class CollectExceptions < Middleware
        def call(env)
          @app.call(env)
        rescue Object => ex
          store( clean_hash(
              "type" => "exception_raised",
              "tags" => @tagging,
              "request" => request_hash(env),
              "response" => exception_hash(ex)
          ))
          raise
        end

        private

        def collection_type
          :exception
        end

        def exception_hash(ex)
          {
            "type" => ex.class.name,
            "message" => ex.message,
            "backtrace" => ex.backtrace[0..10]
          }
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fluoride-collector-0.0.11 lib/fluoride-collector/middleware/collect-exceptions.rb
fluoride-collector-0.0.10 lib/fluoride-collector/middleware/collect-exceptions.rb
fluoride-collector-0.0.9 lib/fluoride-collector/middleware/collect-exceptions.rb
fluoride-collector-0.0.8 lib/fluoride-collector/middleware/collect-exceptions.rb
fluoride-collector-0.0.7 lib/fluoride-collector/middleware/collect-exceptions.rb
fluoride-collector-0.0.6 lib/fluoride-collector/middleware/collect-exceptions.rb
fluoride-collector-0.0.5 lib/fluoride-collector/middleware/collect-exceptions.rb
fluoride-collector-0.0.4 lib/fluoride-collector/middleware/collect-exceptions.rb