Exception: Orchestrate::API::BaseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/orchestrate/api/errors.rb

Overview

Base class for Errors from Orchestrate.

Direct Known Subclasses

RequestError, ServiceError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ 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

#responseFaraday::Response (readonly)



14
15
16
# File 'lib/orchestrate/api/errors.rb', line 14

def response
  @response
end

Class Method Details

.codeString

class-level attr-reader for the error's code.



11
# File 'lib/orchestrate/api/errors.rb', line 11

def self.code; @code; end

.statusInteger

class-level attr-reader for the error's response code.



7
# File 'lib/orchestrate/api/errors.rb', line 7

def self.status; @status; end