Exception: Oz::APIError
Overview
Base class for all errors that originate from interacting with the API.
Carries the HTTP status code, the (parsed) response body, a machine readable error code when the API provides one, and the request_id header so that failures can be correlated with server side logs.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(message = nil, status_code: nil, body: nil, code: nil, request_id: nil, response: nil) ⇒ APIError
constructor
A new instance of APIError.
Constructor Details
#initialize(message = nil, status_code: nil, body: nil, code: nil, request_id: nil, response: nil) ⇒ APIError
Returns a new instance of APIError.
19 20 21 22 23 24 25 26 |
# File 'lib/oz/errors.rb', line 19 def initialize( = nil, status_code: nil, body: nil, code: nil, request_id: nil, response: nil) super() @status_code = status_code @body = body @code = code @request_id = request_id @response = response end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
17 18 19 |
# File 'lib/oz/errors.rb', line 17 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
17 18 19 |
# File 'lib/oz/errors.rb', line 17 def code @code end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
17 18 19 |
# File 'lib/oz/errors.rb', line 17 def request_id @request_id end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
17 18 19 |
# File 'lib/oz/errors.rb', line 17 def response @response end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
17 18 19 |
# File 'lib/oz/errors.rb', line 17 def status_code @status_code end |