Fix coverity issues - unchecked return val, uncaught excepts

This commit is contained in:
Alexey Rybalchenko 2017-10-09 17:23:47 +02:00 committed by Mohammad Al-Turany
parent 896a8d6b7f
commit fb0996268a

View File

@ -24,6 +24,8 @@ int main(int argc, char* argv[])
using namespace fair::mq; using namespace fair::mq;
using namespace fair::mq::hooks; using namespace fair::mq::hooks;
try
{
fair::mq::DeviceRunner runner{argc, argv}; fair::mq::DeviceRunner runner{argc, argv};
// runner.AddHook<LoadPlugins>([](DeviceRunner& r){ // runner.AddHook<LoadPlugins>([](DeviceRunner& r){
@ -47,8 +49,19 @@ int main(int argc, char* argv[])
r.fDevice = std::shared_ptr<FairMQDevice>{getDevice(r.fConfig)}; r.fDevice = std::shared_ptr<FairMQDevice>{getDevice(r.fConfig)};
}); });
return runner.RunWithExceptionHandlers(); return runner.Run();
// Run without builtin catch all exception handler, just: // Run with builtin catch all exception handler, just:
// return runner.Run(); // return runner.RunWithExceptionHandlers();
}
catch (std::exception& e)
{
LOG(ERROR) << "Unhandled exception reached the top of main: " << e.what() << ", application will now exit";
return 1;
}
catch (...)
{
LOG(ERROR) << "Non-exception instance being thrown. Please make sure you use std::runtime_exception() instead. Application will now exit.";
return 1;
}
} }