From 9941e5b13f5b3ab2d1430c1c8fa8dd1b92928510 Mon Sep 17 00:00:00 2001 From: Gavin Halliday Date: Wed, 3 Jan 2024 15:28:28 +0000 Subject: [PATCH] HPCC-31063 Improve the error message when failing to connect to a host ip Signed-off-by: Gavin Halliday --- system/jlib/jsocket.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/system/jlib/jsocket.cpp b/system/jlib/jsocket.cpp index 962d328364b..7271b93cfd2 100644 --- a/system/jlib/jsocket.cpp +++ b/system/jlib/jsocket.cpp @@ -971,7 +971,11 @@ int CSocket::pre_connect (bool block) if (targetip.isNull()) { StringBuffer err; - err.appendf("CSocket::pre_connect - Invalid/missing host IP address raised in : %s, line %d",sanitizeSourceFile(__FILE__), __LINE__); + const char * hostname = targetip.queryHostname(); + if (isEmptyString(hostname)) + err.appendf("CSocket::pre_connect - missing host IP address raised in : %s, line %d",sanitizeSourceFile(__FILE__), __LINE__); + else + err.appendf("CSocket::pre_connect - Invalid host IP address '%s' raised in : %s, line %d", hostname, sanitizeSourceFile(__FILE__), __LINE__); IJSOCK_Exception *e = new SocketException(JSOCKERR_bad_netaddr,err.str()); throw e; }