Exception: Lessonly::ResponseError
- Defined in:
- lib/lessonly/exceptions.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#response ⇒ Object
Returns the value of attribute response.
Attributes inherited from Exception
Instance Method Summary collapse
-
#initialize(message, attrs = {}) ⇒ ResponseError
constructor
A new instance of ResponseError.
Constructor Details
#initialize(message, attrs = {}) ⇒ ResponseError
Returns a new instance of ResponseError.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/lessonly/exceptions.rb', line 15 def initialize(, attrs = {}) self.response = attrs[:response] self.body = attrs[:body] if body.present? && body.key?(:error) error = body[:error] = "#{} (#{error})" elsif response = "#{} (\"#{response.inspect}\")" end super(, attrs) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
13 14 15 |
# File 'lib/lessonly/exceptions.rb', line 13 def body @body end |
#response ⇒ Object
Returns the value of attribute response.
12 13 14 |
# File 'lib/lessonly/exceptions.rb', line 12 def response @response end |