Sha256: f7567c69633d9facf4bdd96e7079a5dfa139ba69a0a3b8f8b27adca39f3cc9a1

Contents?: true

Size: 1001 Bytes

Versions: 44

Compression:

Stored size: 1001 Bytes

Contents

module ChargeBee

  class Error < StandardError
    attr_reader :original_error

    def initialize(message=nil,original_error = nil)
        super message
        @original_error = original_error
    end
  end

  class IOError < Error; end

  class APIError < Error

    attr_reader  :http_status_code, :message, :type, :api_error_code, :param, :json_obj,
                 #Deprecated attributes
                 :http_code, :http_body, :error_code
    
    def initialize(http_code=nil, json_obj = nil)
      super json_obj[:message]
      @json_obj = json_obj
      @http_status_code = http_code
      @type = json_obj[:type]
      @api_error_code = json_obj[:api_error_code]
      @param = json_obj[:param]

      #Deprecated attributes
      @error_code = json_obj[:error_code]
      @http_code = http_code
      @http_body = json_obj.to_s
    end
    
  end


  class OperationFailedError < APIError; end

  class InvalidRequestError < APIError;  end

  class PaymentError < APIError;  end

end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
chargebee-1.4.9 lib/chargebee/errors.rb
chargebee-1.4.8 lib/chargebee/errors.rb
chargebee-1.4.7 lib/chargebee/errors.rb
chargebee-1.4.6 lib/chargebee/errors.rb