How to log C++ exception if running outside debugger, otherwise rethrow
- by Stefan Monov
I wanna do something like this:
int main() {
try { runApp(); }
catch(std::exception const& ex) {
if(runningInDebugger()) throw; // let the IDE show me what went wrong
else displayMsgBox("Something went wrong! " + ex.what());
}
}
Needs to work at least in VS2008 but the more debuggers it supports, the better.
I…