Sha256: 85018cff327edb9c4d569180486d7d16f829771c70a0611a26d79a36cd2421ad

Contents?: true

Size: 922 Bytes

Versions: 2

Compression:

Stored size: 922 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 Gone < ApiClientError; end
    class ServerError < ApiClientError; end
    class UnprocessableEntity < ApiClientError; end
    class TooManyRequests < ApiClientError; end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
api_client-0.5.22 lib/api_client/errors.rb
api_client-0.5.21 lib/api_client/errors.rb