Exception: ShelfWatch::Error
- Inherits:
-
StandardError
- Object
- StandardError
- ShelfWatch::Error
- Defined in:
- lib/shelfwatch/errors.rb
Overview
Base exception for all ShelfWatch SDK errors.
Direct Known Subclasses
AuthenticationError, ForbiddenError, NotFoundError, RateLimitError, ServerError, ValidationError
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(message, status_code: nil, body: nil) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(message, status_code: nil, body: nil) ⇒ Error
Returns a new instance of Error.
8 9 10 11 12 13 |
# File 'lib/shelfwatch/errors.rb', line 8 def initialize(, status_code: nil, body: nil) @message = @status_code = status_code @body = body super(to_s) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/shelfwatch/errors.rb', line 6 def body @body end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/shelfwatch/errors.rb', line 6 def @message end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
6 7 8 |
# File 'lib/shelfwatch/errors.rb', line 6 def status_code @status_code end |
Instance Method Details
#to_s ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/shelfwatch/errors.rb', line 15 def to_s if status_code "[#{status_code}] #{}" else .to_s end end |