Currently, I have this code to prepend a "tag" to an exception message which gives me a very light version of a stack trace:
try {
doSomething();
} catch (std::exception& e) {
int size = 8 + _tcslen(e.what());
TCHAR* error = new TCHAR[size];
_sntprintf(error, size, TEXT("myTag: %s"), e.what());
std::exception x = std::exception(error);
delete []error;
throw x;
}
It just looks horrible and I'm sure that there has to be an easy way to accomplish this. Could you please help me with this?