mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-18 23:13:45 +08:00
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:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user