def request(request)
begin
response = request.execute
rh_sso = response.cookies['rh_sso']
if not rh_sso.nil?
@@headers["cookie"] = "rh_sso=#{rh_sso}"
end
return parse_response(response) unless response.nil? or response.code == 204
rescue RestClient::RequestTimeout => e
raise TimeoutException.new("Connection to server timed out. It is possible the operation finished without being able to report success. Use 'rhc domain show' or 'rhc app status' to check the status of your applications.")
rescue RestClient::ServerBrokeConnection => e
raise ConnectionException.new("Connection to server got interrupted: #{e.message}")
rescue RestClient::ExceptionWithResponse => e
process_error_response(e.response)
rescue => e
raise ResourceAccessException.new("Failed to access resource: #{e.message}")
end
end