Exception: Conductor::ApiError

Inherits:
ConductorError show all
Defined in:
lib/conductor/exceptions.rb

Overview

API-level exception (HTTP errors from server)

Direct Known Subclasses

AuthorizationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, status: nil, code: nil, reason: nil, body: nil, headers: nil) ⇒ ApiError

Returns a new instance of ApiError.



14
15
16
17
18
19
20
21
# File 'lib/conductor/exceptions.rb', line 14

def initialize(message = nil, status: nil, code: nil, reason: nil, body: nil, headers: nil)
  @status = status
  @code = code || status
  @reason = reason
  @body = body
  @headers = headers
  super(message || build_message)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



12
13
14
# File 'lib/conductor/exceptions.rb', line 12

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



12
13
14
# File 'lib/conductor/exceptions.rb', line 12

def code
  @code
end

#headersObject (readonly)

Returns the value of attribute headers.



12
13
14
# File 'lib/conductor/exceptions.rb', line 12

def headers
  @headers
end

#reasonObject (readonly)

Returns the value of attribute reason.



12
13
14
# File 'lib/conductor/exceptions.rb', line 12

def reason
  @reason
end

#statusObject (readonly)

Returns the value of attribute status.



12
13
14
# File 'lib/conductor/exceptions.rb', line 12

def status
  @status
end

Instance Method Details

#not_found?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/conductor/exceptions.rb', line 23

def not_found?
  @code == 404
end