Exception: Alchemrest::ServerError

Inherits:
ResponseError show all
Defined in:
lib/alchemrest/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ResponseError

#deconstruct, #deconstruct_keys

Methods inherited from Error

#deconstruct, #deconstruct_keys

Constructor Details

#initialize(response, cause = nil) ⇒ ServerError

Returns a new instance of ServerError.



43
44
45
46
47
# File 'lib/alchemrest/error.rb', line 43

def initialize(response, cause = nil)
  @response = response
  @cause = cause
  super(response)
end

Instance Attribute Details

#causeObject (readonly)

Returns the value of attribute cause.



41
42
43
# File 'lib/alchemrest/error.rb', line 41

def cause
  @cause
end

#responseObject (readonly)

Returns the value of attribute response.



41
42
43
# File 'lib/alchemrest/error.rb', line 41

def response
  @response
end

Instance Method Details

#to_sObject



49
50
51
52
53
54
55
56
57
# File 'lib/alchemrest/error.rb', line 49

def to_s
  if response.circuit_open?
    "CIRCUIT OPEN"
  elsif response.timeout?
    "#{response.status} timeout"
  else
    error_message
  end
end