Exception: Xendit::APIError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/xendit/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_code, error_message, http_status) ⇒ APIError



7
8
9
10
11
12
13
# File 'lib/xendit/errors.rb', line 7

def initialize(error_code, error_message, http_status)
  @error_code = error_code
  @error_message = error_message
  @http_status = http_status

  super to_s
end

Instance Attribute Details

#error_codeObject (readonly)

Returns the value of attribute error_code.



5
6
7
# File 'lib/xendit/errors.rb', line 5

def error_code
  @error_code
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



5
6
7
# File 'lib/xendit/errors.rb', line 5

def error_message
  @error_message
end

#http_statusObject (readonly)

Returns the value of attribute http_status.



5
6
7
# File 'lib/xendit/errors.rb', line 5

def http_status
  @http_status
end

Instance Method Details

#to_sObject



15
16
17
18
19
# File 'lib/xendit/errors.rb', line 15

def to_s
  status_string = @http_status.nil? ? '' : "(Status #{@http_status}) "
  error_code_string = @error_code.nil? ? '' : "#{error_code} - "
  "#{status_string}#{error_code_string}#{@error_message}"
end