Sha256: d15d521abe12b9de50d1f3cc2da0d017dd34529e23cce596e1e10c06cdc37774

Contents?: true

Size: 1.23 KB

Versions: 19

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

module Qismo
  # Qismo ruby base error
  #
  class Error < StandardError
    attr_reader :message
  end

  # Http timeout error
  #
  class HTTPTimeoutError < Error
  end

  # Http request error
  #
  class HTTPRequestError < Error
    attr_reader :message, :status_code, :response_body

    # Initiate error
    #
    # @param message [String]
    # @param status_code [Integer]
    # @param response_body [String]
    def initialize(message, status_code:, response_body:)
      super(message.to_s)

      @message = message
      @status_code = status_code
      @response_body = response_body
    end
  end

  # Http internal server error
  #
  class InternalServerError < HTTPRequestError
  end

  # Http 400 bad request error
  #
  class BadRequestError < HTTPRequestError
  end

  # Http 401 unauthorized error
  #
  class UnauthorizedError < HTTPRequestError
  end

  # Http 402 payment required error
  #
  class PaymentRequiredError < HTTPRequestError
  end

  # Http 403 forbidden error
  #
  class ForbiddenError < HTTPRequestError
  end

  # Http 404 not found error
  #
  class NotFoundError < HTTPRequestError
  end

  # Http 429 too many requests error
  #
  class TooManyRequestError < HTTPRequestError
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
qismo-0.18.3 lib/qismo/error.rb
qismo-0.18.2 lib/qismo/error.rb
qismo-0.18.1 lib/qismo/error.rb
qismo-0.18.0 lib/qismo/error.rb
qismo-0.17.10 lib/qismo/error.rb
qismo-0.17.9 lib/qismo/error.rb
qismo-0.17.7 lib/qismo/error.rb
qismo-0.17.6 lib/qismo/error.rb
qismo-0.17.5 lib/qismo/error.rb
qismo-0.17.4 lib/qismo/error.rb
qismo-0.17.3 lib/qismo/error.rb
qismo-0.17.2 lib/qismo/error.rb
qismo-0.17.1 lib/qismo/error.rb
qismo-0.17.0 lib/qismo/error.rb
qismo-0.15.0 lib/qismo/error.rb
qismo-0.14.0 lib/qismo/error.rb
qismo-0.13.0 lib/qismo/error.rb
qismo-0.12.1 lib/qismo/error.rb
qismo-0.12.0 lib/qismo/error.rb