Replies: 5 comments 1 reply
-
Not possible, as |
Beta Was this translation helpful? Give feedback.
-
Ok. const char* Exception::what() const noexcept
{
static std::string DoNotTidyOnExit{ displayText() };
return DoNotTidyOnExit.c_str();
} Or use an allocated buffer like in the std::exception |
Beta Was this translation helpful? Give feedback.
-
Making it a static |
Beta Was this translation helpful? Give feedback.
-
If the exception thrown is due to memory pressure then I would agree.
|
Beta Was this translation helpful? Give feedback.
-
Taking each point in turn:
Not a big problem, but see explanation for 3
Unfortuantely this means that due to some optimisation(s), the next exception will internally see that the static has been allocated and return the first instance !!
But the
So this is what I'm using currently: catch (std::exception& ex)
{
TraceCatch(ex);
1 std::string msg{ ex.what() };
2 if (Poco::Exception* pex = dynamic_cast<Poco::Exception*>(&ex);
3 pex != nullptr)
4 {
5 msg = pex->displayText();
6 }
Events evt;
evt.StatsFileTsIdID(tsId)
.Status(LR::SR::LE::IngestSvcDto::FileStatus::Error)
.Message(std::format("Error [{}]", msg))
.create(pContext);
} It would be nice if there is a neater way to do lines 1 -> 6 |
Beta Was this translation helpful? Give feedback.
-
i.e.
So that "Normal exception handlers can see the following style "Rich Text"
Cannot load library: Error 126 while loading [LocalDbStorage1.dll]: [The specified module could not be found.]
and not the current obscure
Cannot load library
Beta Was this translation helpful? Give feedback.
All reactions