class ErrorHandler

Constants

CLIENT_ERROR_STATUSES

Public Instance Methods

on_complete(env) click to toggle source
# File lib/flow_cl/error_handler.rb, line 8
def on_complete(env)
  case env[:status]
  when 404
    raise Faraday::Error::ResourceNotFound, response_values(env)
  when 407
    # mimic the behavior that we get with proxy requests with HTTPS
    raise Faraday::Error::ConnectionFailed, %(407 "Proxy Authentication Required ")
  when CLIENT_ERROR_STATUSES
    raise GenericError, response_values(env)
  end
end
response_values(env) click to toggle source
# File lib/flow_cl/error_handler.rb, line 20
def response_values(env)
  { status: env.status, headers: env.response_headers, body: env.body }
end