Exception: Blanket::Exception
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Blanket::Exception
- Defined in:
- lib/blanket/exception.rb
Overview
The base class for all Blanket Exceptions
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns a formatted error message.
-
#response ⇒ Object
readonly
Attribute reader for the Exception http response.
Instance Method Summary collapse
-
#body ⇒ Object
Returns the HTTP response body.
-
#code ⇒ Object
Returns the HTTP status code.
-
#initialize(response = nil) ⇒ Blanket::Exception
constructor
Creates a new exception.
-
#inspect ⇒ Object
(also: #to_s)
Returns a stringified error message.
Constructor Details
#initialize(response = nil) ⇒ Blanket::Exception
Creates a new exception
59 60 61 |
# File 'lib/blanket/exception.rb', line 59 def initialize(response = nil) @response = response end |
Instance Attribute Details
#message ⇒ Object
Returns a formatted error message
74 75 76 |
# File 'lib/blanket/exception.rb', line 74 def @message || self.class.name end |
#response ⇒ Object (readonly)
Attribute reader for the Exception http response
54 55 56 |
# File 'lib/blanket/exception.rb', line 54 def response @response end |
Instance Method Details
#body ⇒ Object
Returns the HTTP response body
64 65 66 |
# File 'lib/blanket/exception.rb', line 64 def body @response.body.to_s if @response end |
#code ⇒ Object
Returns the HTTP status code
69 70 71 |
# File 'lib/blanket/exception.rb', line 69 def code @response.code.to_i if @response end |
#inspect ⇒ Object Also known as: to_s
Returns a stringified error message
79 80 81 |
# File 'lib/blanket/exception.rb', line 79 def inspect "#{}: #{body}" end |