Exception: DataMapperRest::ConnectionError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/dm-rest-adapter/exceptions.rb

Overview

Snagged from Active Resource, it is clean and does what needs to be done

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.



6
7
8
9
# File 'lib/dm-rest-adapter/exceptions.rb', line 6

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

Instance Attribute Details

#responseObject (readonly)

:nodoc:



4
5
6
# File 'lib/dm-rest-adapter/exceptions.rb', line 4

def response
  @response
end

Instance Method Details

#to_sObject



11
12
13
# File 'lib/dm-rest-adapter/exceptions.rb', line 11

def to_s
  "Resource action failed with code: #{response.code}, message: #{response.message if response.respond_to?(:message)}"
end