Exception: HyperResource::Exception
- Inherits:
-
Exception
- Object
- Exception
- HyperResource::Exception
- Defined in:
- lib/hyper_resource/exceptions.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cause ⇒ Object
Internal exception which led to this.
-
#response ⇒ Object
Response body which led to this.
-
#response_object ⇒ Object
Response object which led to this.
Instance Method Summary collapse
-
#initialize(message, opts = {}) ⇒ Exception
constructor
A new instance of Exception.
Constructor Details
#initialize(message, opts = {}) ⇒ Exception
Returns a new instance of Exception.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/hyper_resource/exceptions.rb', line 7 def initialize(, opts={}) self.response = opts[:response] self.response_object = opts[:response_object] self.cause = opts[:cause] ## Try to help out with the message if self.response_object if error = self.response_object['error'] = "#{} (#{error})" end elsif self.response = "#{} (\"#{self.response.inspect}\")" end super() end |
Instance Attribute Details
#cause ⇒ Object
Internal exception which led to this
5 6 7 |
# File 'lib/hyper_resource/exceptions.rb', line 5 def cause @cause end |
#response ⇒ Object
Response body which led to this
3 4 5 |
# File 'lib/hyper_resource/exceptions.rb', line 3 def response @response end |
#response_object ⇒ Object
Response object which led to this
4 5 6 |
# File 'lib/hyper_resource/exceptions.rb', line 4 def response_object @response_object end |