Class: TheCity::API::Response::RaiseError

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

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



19
20
21
22
23
# File 'lib/the_city/api/response/raise_error.rb', line 19

def on_complete(env)
  status_code = env[:status].to_i
  error_class = TheCity::Error.errors[status_code]
  raise error_class.from_response(env) if error_class
end