Exception: ChargeBee::APIError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/chargebee/api_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, http_code = nil, http_body = nil, json_obj = nil) ⇒ APIError

Returns a new instance of APIError.



6
7
8
9
10
11
12
13
14
15
# File 'lib/chargebee/api_error.rb', line 6

def initialize(message=nil, http_code=nil, http_body=nil, json_obj = nil)
  @message = message
  @http_code = http_code
  @http_body = http_body
  @json_obj = json_obj
  if(json_obj != nil)
    @error_code = json_obj[:error_code]
    @param = json_obj[:param]
  end
end

Instance Attribute Details

#error_codeObject (readonly)

Returns the value of attribute error_code.



4
5
6
# File 'lib/chargebee/api_error.rb', line 4

def error_code
  @error_code
end

#http_bodyObject (readonly)

Returns the value of attribute http_body.



4
5
6
# File 'lib/chargebee/api_error.rb', line 4

def http_body
  @http_body
end

#http_codeObject (readonly)

Returns the value of attribute http_code.



4
5
6
# File 'lib/chargebee/api_error.rb', line 4

def http_code
  @http_code
end

#json_objObject (readonly)

Returns the value of attribute json_obj.



4
5
6
# File 'lib/chargebee/api_error.rb', line 4

def json_obj
  @json_obj
end

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/chargebee/api_error.rb', line 4

def message
  @message
end

#paramObject (readonly)

Returns the value of attribute param.



4
5
6
# File 'lib/chargebee/api_error.rb', line 4

def param
  @param
end

Instance Method Details

#to_sObject



17
18
19
20
# File 'lib/chargebee/api_error.rb', line 17

def to_s
  hc = @http_code.nil? ? "" : "(Http Code #{@http_code}) "
  "#{hc}#{@message}"
end