Exception: Chroma::ChromaError

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

Overview

ChromaError is the base error from which all other more specific Chrome errors derive.

Direct Known Subclasses

APIConnectionError, APIError, InvalidRequestError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, status: nil, body: nil, response: nil) ⇒ ChromaError

Returns a new instance of ChromaError.



14
15
16
17
18
19
# File 'lib/chroma/errors.rb', line 14

def initialize(message = nil, status: nil, body: nil, response: nil)
  @message = message
  @status = status
  @body = body
  @response = response
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



11
12
13
# File 'lib/chroma/errors.rb', line 11

def body
  @body
end

#errorObject (readonly)

Returns the value of attribute error.



10
11
12
# File 'lib/chroma/errors.rb', line 10

def error
  @error
end

#messageObject (readonly)

Returns the value of attribute message.



9
10
11
# File 'lib/chroma/errors.rb', line 9

def message
  @message
end

#responseObject

Returns the value of attribute response.



7
8
9
# File 'lib/chroma/errors.rb', line 7

def response
  @response
end

#statusObject (readonly)

Returns the value of attribute status.



12
13
14
# File 'lib/chroma/errors.rb', line 12

def status
  @status
end

Instance Method Details

#to_sObject



21
22
23
24
# File 'lib/chroma/errors.rb', line 21

def to_s
  status_value = @status.nil? ? "" : "(Status #{@status}) "
  "#{status_value}#{@message}"
end