Exception: Sendeez::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Sendeez::Error
- Defined in:
- lib/sendeez/errors.rb
Overview
Raised for any non-2xx response from the Sendeez API.
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#param ⇒ Object
readonly
Returns the value of attribute param.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#retry_after ⇒ Object
readonly
Returns the value of attribute retry_after.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(status, error, retry_after: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(status, error, retry_after: nil) ⇒ Error
Returns a new instance of Error.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/sendeez/errors.rb', line 8 def initialize(status, error, retry_after: nil) @status = status @type = error["type"] || "api_error" @code = error["code"] || "unknown_error" @param = error["param"] @request_id = error["request_id"] @details = error["details"] @action = error["action"] @retry_after = retry_after super(error["message"] || "Sendeez request failed with HTTP #{status}") end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
6 7 8 |
# File 'lib/sendeez/errors.rb', line 6 def action @action end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/sendeez/errors.rb', line 6 def code @code end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
6 7 8 |
# File 'lib/sendeez/errors.rb', line 6 def details @details end |
#param ⇒ Object (readonly)
Returns the value of attribute param.
6 7 8 |
# File 'lib/sendeez/errors.rb', line 6 def param @param end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
6 7 8 |
# File 'lib/sendeez/errors.rb', line 6 def request_id @request_id end |
#retry_after ⇒ Object (readonly)
Returns the value of attribute retry_after.
6 7 8 |
# File 'lib/sendeez/errors.rb', line 6 def retry_after @retry_after end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/sendeez/errors.rb', line 6 def status @status end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/sendeez/errors.rb', line 6 def type @type end |