Skip to content

Commit

Permalink
Add exception handler for std::invalid_argument
Browse files Browse the repository at this point in the history
Add an exception handler so that we'll get some better log messages if
the live listener background thread ever throws std::invalid_argument.

Refs #6871
  • Loading branch information
rgmiller committed Apr 18, 2013
1 parent d365378 commit c41eccd
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,18 @@ namespace DataHandling

m_backgroundException = boost::shared_ptr<std::runtime_error>( new std::runtime_error( e));

} catch (std::invalid_argument e) { // TimeSeriesProperty (and possibly some other things) can
// can throw these errors
g_log.fatal() << "Caught an invalid argument exception." << std::endl
<< "Exception message: " << e.what() << std::endl
<< "Thread will exit." << std::endl;
m_isConnected = false;
m_workspaceInitialized = true; // see the comments in the default exception
// handler for why we set this value.
std::string newMsg( "Invalid argument exception thrown from the background thread: ");
newMsg += e.what();
m_backgroundException = boost::shared_ptr<std::runtime_error>( new std::runtime_error( newMsg));

} catch (...) { // Default exception handler
g_log.fatal() << "Uncaught exception in SNSLiveEventDataListener network read thread."
<< " Thread is exiting." << std::endl;
Expand Down

0 comments on commit c41eccd

Please sign in to comment.