lib/httpx/session.rb in httpx-0.6.4 vs lib/httpx/session.rb in httpx-0.6.5
- old
+ new
@@ -150,12 +150,17 @@
def send_requests(*requests, options)
connections = []
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 = []
begin