made all getWhat() methods on exceptions consistent. they now

all use format() the same way.  also changed format() to actually
do formatting.  however, it doesn't try looking up formatting
strings by id, it just uses the fallback format string.
This commit is contained in:
crs
2002-07-25 17:52:40 +00:00
parent 1fd8e25f7d
commit f129841b38
10 changed files with 59 additions and 37 deletions

View File

@@ -34,12 +34,21 @@ XSocketAddress::getPort() const throw()
CString
XSocketAddress::getWhat() const throw()
{
return "no address";
/* FIXME
return format("XSocketAddress", "no address: %1:%2",
m_hostname.t_str(),
CString::sprintf("%d", m_port).t_str());
*/
static const char* s_errorID[] = {
"XSocketAddressUnknown",
"XSocketAddressNotFound",
"XSocketAddressNoAddress",
"XSocketAddressBadPort"
};
static const char* s_errorMsg[] = {
"unknown error for: %{1}:%{2}",
"address not found for: %{1}",
"no address for: %{1}",
"invalid port: %{2}"
};
return format(s_errorID[m_error], s_errorMsg[m_error],
m_hostname.c_str(),
CStringUtil::print("%d", m_port).c_str());
}