Sha256: e1dc3d2c1c8c91ec4cea60fbb76b9f1ad280878af3772719f3ec55681679fc6d

Contents?: true

Size: 885 Bytes

Versions: 6

Compression:

Stored size: 885 Bytes

Contents

module ApiClient

  module Errors
    class ApiClientError < StandardError
      def initialize(message = nil, request = nil, response = nil)
        message ||= "Status code: #{response.status}" if response
        super(message)
        @request = request
        @response = response
      end

      attr_reader :request, :response
    end

    class ConnectionFailed < ApiClientError; end
    class Config < ApiClientError; end
    class Unauthorized < ApiClientError; end
    class Forbidden < ApiClientError; end
    class NotFound < ApiClientError; end
    class Redirect < ApiClientError; end
    class BadRequest < ApiClientError; end
    class Unsupported < ApiClientError; end
    class Conflict < ApiClientError; end
    class ServerError < ApiClientError; end
    class UnprocessableEntity < ApiClientError; end
    class TooManyRequests < ApiClientError; end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
api_client-0.5.20 lib/api_client/errors.rb
api_client-0.5.19 lib/api_client/errors.rb
api_client-0.5.18 lib/api_client/errors.rb
api_client-0.5.17 lib/api_client/errors.rb
api_client-0.5.16 lib/api_client/errors.rb
api_client-0.5.15 lib/api_client/errors.rb