Exception: XIVAPI::Errors::RequestError

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

Overview

Standard request error

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ RequestError

Returns a new instance of RequestError



6
7
8
9
10
11
12
13
14
# File 'lib/xivapi/errors.rb', line 6

def initialize(response)
  if response.headers[:content_type] =~ /json/
    message = JSON.parse(response)['Message']
  else
    message = 'Error contacting the API.'
  end

  super(message)
end