Exception: ApRubySdk::ApError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, http_status = nil, error_code = nil) ⇒ ApError

Returns a new instance of ApError.



7
8
9
10
11
# File 'lib/ap_ruby_sdk/errors/ap_error.rb', line 7

def initialize(message=nil, http_status=nil, error_code=nil)
  @message = message
  @http_status = http_status
  @error_code = error_code
end

Instance Attribute Details

#error_codeObject (readonly)

Returns the value of attribute error_code.



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

def error_code
  @error_code
end

#http_statusObject (readonly)

Returns the value of attribute http_status.



4
5
6
# File 'lib/ap_ruby_sdk/errors/ap_error.rb', line 4

def http_status
  @http_status
end

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/ap_ruby_sdk/errors/ap_error.rb', line 3

def message
  @message
end

Instance Method Details

#to_sObject



13
14
15
16
17
# File 'lib/ap_ruby_sdk/errors/ap_error.rb', line 13

def to_s
  status_string = @http_status.nil? ? '' : "(Status #{@http_status})"
  error_code = @error_code.nil? ? '' : "Error code #{@error_code}"
  "#{status_string}\n#{@message}\n#{error_code}"
end