improved error messages for bad addresses.

This commit is contained in:
crs 2002-07-25 17:58:01 +00:00
parent f129841b38
commit 4688c99ee4
3 changed files with 8 additions and 8 deletions

View File

@ -406,9 +406,9 @@ parse(int argc, const char** argv)
try {
s_serverAddress = CNetworkAddress(argv[i], kDefaultPort);
}
catch (XSocketAddress&) {
log((CLOG_PRINT "%s: invalid server address" BYE,
pname, pname));
catch (XSocketAddress& e) {
log((CLOG_PRINT "%s: %s" BYE,
pname, e.what(), pname));
bye(kExitArgs);
}
}

View File

@ -44,7 +44,7 @@ XSocketAddress::getWhat() const throw()
"unknown error for: %{1}:%{2}",
"address not found for: %{1}",
"no address for: %{1}",
"invalid port: %{2}"
"invalid port" // m_port may not be set to the bad port
};
return format(s_errorID[m_error], s_errorMsg[m_error],
m_hostname.c_str(),

View File

@ -337,8 +337,8 @@ parse(int argc, const char** argv)
s_synergyAddress = CNetworkAddress(argv[i + 1], kDefaultPort);
}
catch (XSocketAddress& e) {
log((CLOG_PRINT "%s: invalid address for `%s'. %s." BYE,
pname, argv[i], e.what(), pname));
log((CLOG_PRINT "%s: %s" BYE,
pname, e.what(), pname));
bye(kExitArgs);
}
++i;
@ -350,8 +350,8 @@ parse(int argc, const char** argv)
s_httpAddress = CNetworkAddress(argv[i + 1], kDefaultPort + 1);
}
catch (XSocketAddress& e) {
log((CLOG_PRINT "%s: invalid address for `%s'. %s." BYE,
pname, argv[i], e.what(), pname));
log((CLOG_PRINT "%s: %s" BYE,
pname, e.what(), pname));
bye(kExitArgs);
}
++i;