Exception: Anzu::Error

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

Class Method Summary collapse

Class Method Details

.raise_from_response(response) ⇒ Object



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

def self.raise_from_response(response)
  response.value
rescue StandardError
  begin
    json = JSON.parse(response.body)
    raise Error, json['error']
  rescue StandardError
    raise Error, response.body
  end
end