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

@@ -1,5 +1,6 @@
#include "XBase.h"
#include <cerrno>
#include <cstdarg>
// win32 wants a const char* argument to std::exception c'tor
#if WINDOWS_LIKE
@@ -46,9 +47,22 @@ XBase::what() const
CString
XBase::format(const char* /*id*/, const char* fmt, ...) const throw()
{
// FIXME -- use id to lookup formating string
// FIXME -- format string with arguments
return fmt;
// FIXME -- lookup message string using id as an index. set
// fmt to that string if it exists.
// format
CString result;
va_list args;
va_start(args, fmt);
try {
result = CStringUtil::vformat(fmt, args);
}
catch (...) {
// ignore
}
va_end(args);
return result;
}