lib/httpx/resolver/resolver_mixin.rb in httpx-0.3.0 vs lib/httpx/resolver/resolver_mixin.rb in httpx-0.3.1

- old
+ new

@@ -19,10 +19,11 @@ end def uncache(channel) hostname = hostname || @queries.key(channel) || channel.uri.host Resolver.uncache(hostname) + @_record_types[hostname].shift end private def emit_addresses(channel, addresses) @@ -49,12 +50,13 @@ ips = @system_resolver.getaddresses(hostname) return if ips.empty? ips.map { |ip| IPAddr.new(ip) } end - def emit_resolve_error(channel, hostname) - error = ResolveError.new("Can't resolve #{hostname}") - error.set_backtrace(caller) + def emit_resolve_error(channel, hostname, ex = nil) + message = ex ? ex.message : "Can't resolve #{hostname}" + error = ResolveError.new(message) + error.set_backtrace(ex ? ex.backtrace : caller) emit(:error, channel, error) end end end end