Exception: WhatsAppNotifier::ServiceError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- WhatsAppNotifier::ServiceError
- Defined in:
- lib/whatsapp_notifier/errors.rb
Overview
Raised when the service answers a non-2xx. Carries the HTTP status so callers classify on the status instead of re-parsing the message text.
Subclasses RuntimeError, NOT WhatsAppNotifier::Error: before 0.9.0 this
was a bare raise "service request failed (...)", so hosts wrote
rescue RuntimeError around media fetches and status polls. Hanging it
off Error instead would silently stop those rescues from firing and turn
a handled 5xx into an unhandled one.
The message keeps its pre-0.9.0 wording ("service request failed (401): ...") for the same reason — hosts that fingerprinted that string keep matching while they migrate to Result#error_code.
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(message, status: nil) ⇒ ServiceError
constructor
A new instance of ServiceError.
Constructor Details
#initialize(message, status: nil) ⇒ ServiceError
Returns a new instance of ServiceError.
21 22 23 24 |
# File 'lib/whatsapp_notifier/errors.rb', line 21 def initialize(, status: nil) super() @status = status end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
19 20 21 |
# File 'lib/whatsapp_notifier/errors.rb', line 19 def status @status end |