Sha256: 2c6506e9ef725e4d3ccf3111712183be8a2e96138f18533d70e726a763ee6eb5

Contents?: true

Size: 383 Bytes

Versions: 8

Compression:

Stored size: 383 Bytes

Contents

require 'rest-core/middleware'

class RestCore::ErrorDetector
  def self.members; [:error_detector]; end
  include RestCore::Middleware

  def call env
    app.call(env){ |response|
      detector = error_detector(env)
      yield(
        if error = (detector && detector.call(response))
          fail(response, error)
        else
          response
        end)
    }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rest-core-2.1.2 lib/rest-core/middleware/error_detector.rb
rest-core-2.1.1 lib/rest-core/middleware/error_detector.rb
rest-core-2.1.0 lib/rest-core/middleware/error_detector.rb
rest-core-2.0.4 lib/rest-core/middleware/error_detector.rb
rest-core-2.0.3 lib/rest-core/middleware/error_detector.rb
rest-core-2.0.2 lib/rest-core/middleware/error_detector.rb
rest-core-2.0.1 lib/rest-core/middleware/error_detector.rb
rest-core-2.0.0 lib/rest-core/middleware/error_detector.rb