Exception: PaypalClient::Errors::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_message = nil, http_status: nil, http_body: nil, code: nil) ⇒ Error

Returns a new instance of Error.



13
14
15
16
17
18
19
20
# File 'lib/paypal_client/errors.rb', line 13

def initialize(error_message = nil, http_status: nil, http_body: nil, code: nil)
  @error_message = error_message
  @http_status = http_status
  @http_body = http_body
  @code = code

  super(@error)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



8
9
10
# File 'lib/paypal_client/errors.rb', line 8

def code
  @code
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



11
12
13
# File 'lib/paypal_client/errors.rb', line 11

def error_message
  @error_message
end

#http_bodyObject (readonly)

Returns the value of attribute http_body.



9
10
11
# File 'lib/paypal_client/errors.rb', line 9

def http_body
  @http_body
end

#http_statusObject (readonly)

Returns the value of attribute http_status.



10
11
12
# File 'lib/paypal_client/errors.rb', line 10

def http_status
  @http_status
end

Instance Method Details

#inspectObject



22
23
24
25
26
27
# File 'lib/paypal_client/errors.rb', line 22

def inspect
  extra = []
  extra << " status_code: #{http_status}" unless http_status.nil?
  extra << " body: #{http_body}" unless http_body.nil?
  "#<#{self.class.name}: #{message}#{extra.join}>"
end

#messageObject



29
30
31
# File 'lib/paypal_client/errors.rb', line 29

def message
  "#{code}: #{error_message} (#{http_status})"
end