Sha256: 24fa9b3ab742b1195c5da43cfa58d35016bcab8c21359f267f260e75d5a8cfaa

Contents?: true

Size: 395 Bytes

Versions: 5

Compression:

Stored size: 395 Bytes

Contents

module Nearmiss
  # Faraday response middleware
  module Response

    # This class raises an Nearmiss-flavored exception based
    # HTTP status codes returned by the API
    class RaiseError < Faraday::Response::Middleware

      private

      def on_complete(response)
        if error = Nearmiss::Error.from_response(response)
          raise error
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nearmiss-ruby-1.0.4 lib/nearmiss-ruby/raise_error.rb
nearmiss-ruby-1.0.3 lib/nearmiss-ruby/raise_error.rb
nearmiss-ruby-1.0.2 lib/nearmiss-ruby/raise_error.rb
nearmiss-ruby-1.0.1 lib/nearmiss-ruby/raise_error.rb
nearmiss-ruby-1.0.0 lib/nearmiss-ruby/raise_error.rb