Exception: Pictify::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Pictify::Error
- Defined in:
- lib/pictify/errors.rb
Overview
Base error class for all Pictify errors.
Direct Known Subclasses
AuthenticationError, NetworkError, QuotaExceededError, RateLimitError, RenderError, ServerError, TemplateNotFoundError, TimeoutError
Instance Attribute Summary collapse
-
#response_body ⇒ Object
readonly
Returns the value of attribute response_body.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(message = nil, status_code: nil, response_body: nil) ⇒ Error
constructor
A new instance of Error.
- #message ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(message = nil, status_code: nil, response_body: nil) ⇒ Error
Returns a new instance of Error.
8 9 10 11 12 13 |
# File 'lib/pictify/errors.rb', line 8 def initialize( = nil, status_code: nil, response_body: nil) @status_code = status_code @response_body = response_body @raw_message = || super(@raw_message) end |
Instance Attribute Details
#response_body ⇒ Object (readonly)
Returns the value of attribute response_body.
6 7 8 |
# File 'lib/pictify/errors.rb', line 6 def response_body @response_body end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
6 7 8 |
# File 'lib/pictify/errors.rb', line 6 def status_code @status_code end |
Instance Method Details
#message ⇒ Object
15 16 17 |
# File 'lib/pictify/errors.rb', line 15 def @raw_message end |
#to_s ⇒ Object
19 20 21 22 23 |
# File 'lib/pictify/errors.rb', line 19 def to_s return "[#{status_code}] #{@raw_message}" if status_code @raw_message end |