You must catch the exception to see the string. It may be useful to have an exception handler in the latter case as follows:
int main(int argc, char **argv)
{
try {
...
}
catch(const std::exception& e) {
std::cout << "Uncaught exception: " << e.what() << std::endl;
}
}
In a GUI application, you can have a catch statement in the loop of the main event and display an error message in the message box.
In an event-driven application without a GUI, you can also have a catch statement in the main event loop and write the error message to the log file.
These methods will allow you to see all the exceptions. Of course, most exceptions should be caught before they reach your last-resort exception handler.
source
share