Sha256: 185cb5afd0b28d72f99236d6e2a8557cedc7c1bf510979e717b535e93c9ff159

Contents?: true

Size: 402 Bytes

Versions: 5

Compression:

Stored size: 402 Bytes

Contents

require 'faraday'
require 'ivapi/error'

module Ivapi
  # Faraday response middleware
  module Response
    # This class raises an exception based HTTP status codes returned
    # by the API.
    class RaiseError < Faraday::Response::Middleware
      private

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ivapi-1.5.0 lib/ivapi/response/raise_error.rb
ivapi-1.4.0 lib/ivapi/response/raise_error.rb
ivapi-1.3.0 lib/ivapi/response/raise_error.rb
ivapi-1.2.0 lib/ivapi/response/raise_error.rb
ivapi-1.1.8 lib/ivapi/response/raise_error.rb