Sha256: 77db03cd764d305edee1f7482ac19eb4e0915b408a4e4936f5601fcd41540059

Contents?: true

Size: 436 Bytes

Versions: 9

Compression:

Stored size: 436 Bytes

Contents

require 'faraday'
require 'buildkit/error'

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
buildkit-1.4.0 lib/buildkit/response/raise_error.rb
buildkit-1.3.0 lib/buildkit/response/raise_error.rb
buildkit-1.2.0 lib/buildkit/response/raise_error.rb
buildkit-1.1.1 lib/buildkit/response/raise_error.rb
buildkit-1.0.0 lib/buildkit/response/raise_error.rb
buildkit-0.4.0 lib/buildkit/response/raise_error.rb
buildkit-0.3.0 lib/buildkit/response/raise_error.rb
buildkit-0.2.0 lib/buildkit/response/raise_error.rb
buildkit-0.1.0 lib/buildkit/response/raise_error.rb