Exception: Orchestrate::API::BaseError
- Inherits:
-
StandardError
- Object
- StandardError
- Orchestrate::API::BaseError
- Defined in:
- lib/orchestrate/api/errors.rb
Overview
Base class for Errors from Orchestrate.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#response ⇒ Faraday::Response
readonly
The response that caused the error.
Class Method Summary collapse
-
.code ⇒ String
class-level attr-reader for the error's code.
-
.status ⇒ Integer
class-level attr-reader for the error's response code.
Instance Method Summary collapse
-
#initialize(response) ⇒ BaseError
constructor
A new instance of BaseError.
Constructor Details
#initialize(response) ⇒ BaseError
Returns a new instance of BaseError.
17 18 19 20 21 22 23 24 |
# File 'lib/orchestrate/api/errors.rb', line 17 def initialize(response) @response = response if response.headers['Content-Type'] == 'application/json' && response.body super(response.body['message']) else super(response.body) end end |
Instance Attribute Details
#response ⇒ Faraday::Response (readonly)
Returns The response that caused the error.
14 15 16 |
# File 'lib/orchestrate/api/errors.rb', line 14 def response @response end |
Class Method Details
.code ⇒ String
class-level attr-reader for the error's code.
11 |
# File 'lib/orchestrate/api/errors.rb', line 11 def self.code; @code; end |
.status ⇒ Integer
class-level attr-reader for the error's response code.
7 |
# File 'lib/orchestrate/api/errors.rb', line 7 def self.status; @status; end |