Test exceptions thrown in user code

This commit is contained in:
Dennis Klein
2018-10-09 20:46:23 +02:00
committed by Dennis Klein
parent bde12f58b2
commit e39316c866
6 changed files with 166 additions and 6 deletions

View File

@@ -111,12 +111,10 @@ auto DeviceRunner::RunWithExceptionHandlers() -> int
try {
return Run();
} catch (std::exception& e) {
LOG(error) << "Unhandled exception reached the top of main: " << e.what()
<< ", application will now exit";
LOG(error) << "Uncaught exception reached the top of DeviceRunner: " << e.what();
return 1;
} catch (...) {
LOG(error) << "Non-exception instance being thrown. Please make sure you use "
"std::runtime_exception() instead. Application will now exit.";
LOG(error) << "Uncaught exception reached the top of DeviceRunner.";
return 1;
}
}

View File

@@ -56,12 +56,12 @@ int main(int argc, char* argv[])
}
catch (std::exception& e)
{
LOG(error) << "Unhandled exception reached the top of main: " << e.what() << ", application will now exit";
LOG(error) << "Uncaught exception reached the top of main: " << e.what();
return 1;
}
catch (...)
{
LOG(error) << "Non-exception instance being thrown. Please make sure you use std::runtime_exception() instead. Application will now exit.";
LOG(error) << "Uncaught exception reached the top of main.";
return 1;
}
}