Exception: WorldMonitor::APIError

Inherits:
Error
  • Object
show all
Defined in:
lib/worldmonitor.rb

Overview

A REST or transport-level failure (non-2xx HTTP response).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, body) ⇒ APIError

Returns a new instance of APIError.



53
54
55
56
57
58
# File 'lib/worldmonitor.rb', line 53

def initialize(status, body)
  @status = status
  @body = body
  hint = status == 401 ? " #{AUTH_HINT}" : ""
  super("HTTP #{status}: #{Client.truncate(body)}#{hint}")
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



51
52
53
# File 'lib/worldmonitor.rb', line 51

def body
  @body
end

#statusObject (readonly)

Returns the value of attribute status.



51
52
53
# File 'lib/worldmonitor.rb', line 51

def status
  @status
end