Class: LondonCab::Faraday::Response::RaiseError

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/london_cab/faraday/response/raise_error.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



5
6
7
8
9
10
# File 'lib/london_cab/faraday/response/raise_error.rb', line 5

def on_complete(env)
  body = env.body
  return body['Result'] unless body['HasError']

  raise LondonCab::Api::Error.new(body['Messgage'], env.response)
end