Exception: SuntechRails::Core::Exceptions::ConnectionError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/suntech_rails/core/exceptions.rb

Overview

:nodoc:

Direct Known Subclasses

ClientError, Redirection, ServerError, TimeoutError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, message = nil) ⇒ ConnectionError

Returns a new instance of ConnectionError.



9
10
11
12
# File 'lib/suntech_rails/core/exceptions.rb', line 9

def initialize(response, message = nil)
  @response = response
  @message  = message
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



7
8
9
# File 'lib/suntech_rails/core/exceptions.rb', line 7

def response
  @response
end

Instance Method Details

#to_sObject



14
15
16
17
18
19
# File 'lib/suntech_rails/core/exceptions.rb', line 14

def to_s
  message = "Failed."
  message << "  Response code = #{response.code}." if response.respond_to?(:code)
  message << "  Response message = #{response.message}." if response.respond_to?(:message)
  message
end