Sha256: 3a8c02e094cba6ed601c59977c0d5e22836250adf383298e14e6c2e40b004ba2

Contents?: true

Size: 434 Bytes

Versions: 3

Compression:

Stored size: 434 Bytes

Contents

require 'faraday'
require 'oktakit/error'

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oktakit-0.3.3 lib/oktakit/response/raise_error.rb
oktakit-0.3.2 lib/oktakit/response/raise_error.rb
oktakit-0.3.1 lib/oktakit/response/raise_error.rb