Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#290 Poco::Exception::what() should return displayText().c_str()

Feature_Request
closed
nobody
5
2012-09-14
2009-09-17
Anonymous
No

Poco::Exception::what() currently only returns name(), which is too little info. All useful information is missing when a derived class of
Poco::Exception is thrown and the exception handler accesses it via base class std::exception.
For instance, a poco_assert(...) failing in a boost::unit_test will only print out "std::exception: Assertion violation", missing precious condition, file, line information.
Therefore, I believe Poco::Exception::what() should return displayText().c_str() instead of name()

Discussion

  • We cannot do that as the result of displayText().c_str() will no longer be a valid pointer when what() returns. That's why we're returning name(), which returns a pointer to a static string.