Class: Vertebrae::Response::RaiseError

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

Instance Method Summary collapse

Instance Method Details

#on_complete(response) ⇒ Object



9
10
11
12
13
14
# File 'lib/vertebrae/response/raise_error.rb', line 9

def on_complete(response)
  status_code = response[:status].to_i
  if (400...600).include? status_code
    raise ResponseError.new(status_code, response)
  end
end