Exception: PayPal::SDK::Core::Exceptions::ConnectionError
- Inherits:
-
StandardError
- Object
- StandardError
- PayPal::SDK::Core::Exceptions::ConnectionError
- Defined in:
- lib/paypal-sdk/core/exceptions.rb
Overview
:nodoc:
Direct Known Subclasses
ClientError, Redirection, SSLError, ServerError, TimeoutError
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response, message = nil) ⇒ ConnectionError
constructor
A new instance of ConnectionError.
- #to_s ⇒ Object
Constructor Details
#initialize(response, message = nil) ⇒ ConnectionError
Returns a new instance of ConnectionError.
9 10 11 12 |
# File 'lib/paypal-sdk/core/exceptions.rb', line 9 def initialize(response, = nil) @response = response @message = end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/paypal-sdk/core/exceptions.rb', line 7 def response @response end |
Instance Method Details
#to_s ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/paypal-sdk/core/exceptions.rb', line 14 def to_s begin response_body = JSON.parse(response.body) debug_id = response["paypal-debug-id"] debug_id = response["correlation-id"] if debug_id.to_s == '' debug_id = response_body["debug_id"] if debug_id.to_s == '' rescue end = "Failed." << " Response code = #{response.code}." if response.respond_to?(:code) << " Response message = #{response.}." if response.respond_to?(:message) << " Response debug ID = #{debug_id}." if debug_id end |