mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-08 00:02:42 -04:00
handle the special case of system resolver which has to bubble up differently than all other errors
This commit is contained in:
parent
731db5691b
commit
cfc039e32e
@ -34,7 +34,7 @@ module HTTPX
|
||||
ip_resolve(hostname) ||
|
||||
system_resolve(hostname) ||
|
||||
@resolver.getaddresses(hostname)
|
||||
return emit_resolve_error(connection, hostname) if addresses.empty?
|
||||
throw(:resolve_error, resolve_error(hostname)) if addresses.empty?
|
||||
|
||||
emit_addresses(connection, addresses)
|
||||
rescue Errno::EHOSTUNREACH, *RESOLV_ERRORS => e
|
||||
|
@ -152,9 +152,14 @@ module HTTPX
|
||||
request_options = @options.merge(options)
|
||||
|
||||
requests.each do |request|
|
||||
connection = find_connection(request, connections, request_options)
|
||||
connection.send(request)
|
||||
set_request_timeout(connection, request, request_options)
|
||||
error = catch(:resolve_error) do
|
||||
connection = find_connection(request, connections, request_options)
|
||||
connection.send(request)
|
||||
set_request_timeout(connection, request, request_options)
|
||||
end
|
||||
next unless error.is_a?(ResolveError)
|
||||
|
||||
request.emit(:response, ErrorResponse.new(request, error, options))
|
||||
end
|
||||
|
||||
responses = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user