Diff

net/connect.lua @ 11901:26406ce35e20

net.connect: Propagate last error message from resolvers Previously it would only say "unable to resolve server" for all DNS problems. While "NoError in A lookup" might not make much sense to users, it should help in debugging more than the previous generic error. Friendlier errors will be future work.
author Kim Alvefur <zash@zash.se>
date Fri, 12 Nov 2021 16:52:55 +0100
parent 10945:2edb72ef312a
child 11903:baf69f254753
line wrap: on
line diff
--- a/net/connect.lua	Fri Nov 12 13:30:39 2021 +0000
+++ b/net/connect.lua	Fri Nov 12 16:52:55 2021 +0100
@@ -35,9 +35,9 @@
 	p.target_resolver:next(function (conn_type, ip, port, extra)
 		if not conn_type then
 			-- No more targets to try
-			p:log("debug", "No more connection targets to try");
+			p:log("debug", "No more connection targets to try", p.target_resolver.last_error);
 			if p.listeners.onfail then
-				p.listeners.onfail(p.data, p.last_error or "unable to resolve service");
+				p.listeners.onfail(p.data, p.target_resolver.last_error or p.last_error or "unable to resolve service");
 			end
 			return;
 		end