mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 17:30:44 +02:00
added poco_unexpected() macro invoking Bugcheck::unexpected() to deal with unexpected exceptions in destructors
This commit is contained in:
@@ -57,6 +57,35 @@ void Bugcheck::bugcheck(const char* msg, const char* file, int line)
|
||||
}
|
||||
|
||||
|
||||
void Bugcheck::unexpected(const char* file, int line)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string msg("Caught exception in destructor: ");
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Poco::Exception& exc)
|
||||
{
|
||||
msg += exc.displayText();
|
||||
}
|
||||
catch (std::exception& exc)
|
||||
{
|
||||
msg += exc.what();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
msg += "unknown exception";
|
||||
}
|
||||
Debugger::enter(msg, file, line);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Bugcheck::debugger(const char* file, int line)
|
||||
{
|
||||
Debugger::enter(file, line);
|
||||
@@ -78,6 +107,4 @@ std::string Bugcheck::what(const char* msg, const char* file, int line)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
Reference in New Issue
Block a user