In my C++ app, I'm making a call to System() that crashes the app sometimes (it's a service). I'd like to catch the exception that is thrown and log it. I don't know what exactly to catch, though, and I can't even do a blanket catch:
try
{
system(myCommand);
}
catch (...)
{
Log("Error!"); // this is a custom log method
}
That doesn't log anything. Shouldn't that catch every type of exception? And more importantly, how do I know what the System() method will throw so that I know what to catch?