Sha256: cc319a2bb6b7c3f981d61f0ea0bd7c72ba9ae461abba689734973fba8a0b7595

Contents?: true

Size: 502 Bytes

Versions: 3

Compression:

Stored size: 502 Bytes

Contents

module Cic
  class CicError < StandardError; end

  module Exception 

    class APIError < ::Cic::CicError
      attr_accessor :http_status, :response_body

      def initialize(http_status, response_body, error_info = nil)
        message = " [HTTP #{http_status}] #{response_body}"
        super(message)
      end
    end

    # Any error with a 5xx HTTP status code
    class ServerError < APIError; end

    # Any error with a 4xx HTTP status code
    class ClientError < APIError; end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cic-1.0.2 lib/cic/errors.rb
cic-1.0.1 lib/cic/errors.rb
cic-1.0.0 lib/cic/errors.rb