Catch exceptions in background threads

This commit is contained in:
Dan Paulat 2024-06-12 01:03:58 -05:00
parent 863cdd0384
commit e1d61fccfa
13 changed files with 866 additions and 665 deletions

View file

@ -237,10 +237,19 @@ void OverlayProductView::Impl::LoadProduct(
}
// Load file
boost::asio::post(
threadPool_,
[=, this]()
{ radarProductManager_->LoadLevel3Data(product, time, request); });
boost::asio::post(threadPool_,
[=, this]()
{
try
{
radarProductManager_->LoadLevel3Data(
product, time, request);
}
catch (const std::exception& ex)
{
logger_->error(ex.what());
}
});
}
void OverlayProductView::Impl::ResetProducts()

View file

@ -121,7 +121,18 @@ void RadarProductView::SelectTime(std::chrono::system_clock::time_point time)
void RadarProductView::Update()
{
boost::asio::post(thread_pool(), [this]() { ComputeSweep(); });
boost::asio::post(thread_pool(),
[this]()
{
try
{
ComputeSweep();
}
catch (const std::exception& ex)
{
logger_->error(ex.what());
}
});
}
bool RadarProductView::IsInitialized() const