Exception: SuperPDP::APIError
- Defined in:
- lib/super_pdp/error.rb
Overview
Raised for any non-2xx HTTP response. Carries the status and parsed body.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status, body) ⇒ APIError
constructor
A new instance of APIError.
Constructor Details
#initialize(status, body) ⇒ APIError
Returns a new instance of APIError.
10 11 12 13 14 15 |
# File 'lib/super_pdp/error.rb', line 10 def initialize(status, body) @status = status @body = body = body.is_a?(Hash) ? (body["message"] || body["error"] || body.to_s) : body.to_s super("SuperPDP API error #{status}: #{}") end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/super_pdp/error.rb', line 8 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/super_pdp/error.rb', line 8 def status @status end |