# frozen_string_literal: true module Qismo # # Qismo generic error # @!attribute message [String] # class Error < StandardError end # # Qismo HTTP error # # @attribute message [String] # @attribute http_code [Integer] # @attribute http_headers [Hash] # @attribute http_body [Hash,String] # @attribute http_raw_body [String] # class HTTPError < StandardError attr_accessor :message, :http_code, :http_headers, :http_body, :http_raw_body def initialize(message = nil, http_code: nil, http_headers: nil, http_body: nil, http_raw_body: nil) @message = message @http_code = http_code @http_headers = http_headers @http_body = http_body @http_raw_body = http_raw_body end end # Error for 5xx status code ServerError = Class.new(HTTPError) # Error for 500 status code InternalServerError = Class.new(ServerError) # Error for 4xx status code ClientError = Class.new(HTTPError) # Error for 400 status code BadRequest = Class.new(ClientError) # Error for 401 status code Unauthorized = Class.new(ClientError) # Error for 402 status code PaymentRequired = Class.new(ClientError) # Error for 403 status code Forbidden = Class.new(ClientError) # Error for 404 status code NotFound = Class.new(ClientError) # Error for 429 status code RateLimitExceeded = Class.new(ClientError) end