Sha256: 038976ae67849522e81e9ad7c572eeb3eb5ed805b55b56b42550e2d65c1e40db

Contents?: true

Size: 442 Bytes

Versions: 3

Compression:

Stored size: 442 Bytes

Contents

# frozen_string_literal: true

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::Middleware
      def on_complete(response)
        if error = Buildkit::Error.from_response(response)
          raise error
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
buildkit-1.6.1 lib/buildkit/response/raise_error.rb
buildkit-1.6.0 lib/buildkit/response/raise_error.rb
buildkit-1.5.0 lib/buildkit/response/raise_error.rb