Method: EasyPing::APIError#initialize
- Defined in:
- lib/easy_ping/error.rb
#initialize(response) ⇒ APIError
Returns a new instance of APIError.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/easy_ping/error.rb', line 27 def initialize(response) @status = response.status @error = JSON.parse(response.body)['error'] rescue {} @type = @error['type'] @code = @error['code'] @param = @error['param'] @message = @error['message'] = "Server responded with status #{@status}." += " Full Message: #{@message}." if @message super() end |