Fix uncaught exceptions

This commit is contained in:
Alexey Rybalchenko 2015-06-19 09:56:01 +02:00
parent d6a413534a
commit e5313d03fe
3 changed files with 49 additions and 33 deletions

View File

@ -141,7 +141,7 @@ install(FILES ${FAIRMQHEADERS} DESTINATION include)
set(DEPENDENCIES
${DEPENDENCIES}
boost_thread boost_timer boost_system boost_program_options boost_random boost_chrono
boost_thread boost_timer boost_system boost_program_options boost_random boost_chrono boost_exception
)
set(LIBRARY_NAME FairMQ)

View File

@ -12,6 +12,8 @@
* @author D. Klein, A. Rybalchenko
*/
#include <boost/exception/all.hpp>
#include <boost/chrono.hpp> // for WaitForEndOfStateForMs()
#include "FairMQStateMachine.h"
@ -96,9 +98,9 @@ bool FairMQStateMachine::ChangeState(int event)
return false;
}
}
catch (std::exception& e)
catch (boost::exception &e)
{
LOG(ERROR) << e.what();
LOG(ERROR) << boost::diagnostic_information(e);
}
}
@ -108,6 +110,8 @@ bool FairMQStateMachine::ChangeState(std::string event)
}
void FairMQStateMachine::WaitForEndOfState(int event)
{
try
{
switch (event)
{
@ -129,6 +133,11 @@ void FairMQStateMachine::WaitForEndOfState(int event)
break;
}
}
catch (boost::exception &e)
{
LOG(ERROR) << boost::diagnostic_information(e);
}
}
void FairMQStateMachine::WaitForEndOfState(std::string event)
{
@ -136,6 +145,8 @@ void FairMQStateMachine::WaitForEndOfState(std::string event)
}
bool FairMQStateMachine::WaitForEndOfStateForMs(int event, int durationInMs)
{
try
{
switch (event)
{
@ -159,7 +170,12 @@ bool FairMQStateMachine::WaitForEndOfStateForMs(int event, int durationInMs)
}
default:
LOG(ERROR) << "Requested state is either synchronous or does not exist.";
break;
return false;
}
}
catch (boost::exception &e)
{
LOG(ERROR) << boost::diagnostic_information(e);
}
}