mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:10:04 +00:00 
			
		
		
		
	Catch exceptions in background threads
This commit is contained in:
		
							parent
							
								
									863cdd0384
								
							
						
					
					
						commit
						e1d61fccfa
					
				
					 13 changed files with 866 additions and 665 deletions
				
			
		|  | @ -1638,15 +1638,22 @@ void MapWidgetImpl::RadarProductManagerConnect() | |||
|                   threadPool_, | ||||
|                   [=, this]() | ||||
|                   { | ||||
|                      if (group == common::RadarProductGroup::Level2) | ||||
|                      try | ||||
|                      { | ||||
|                         radarProductManager_->LoadLevel2Data(latestTime, | ||||
|                                                              request); | ||||
|                         if (group == common::RadarProductGroup::Level2) | ||||
|                         { | ||||
|                            radarProductManager_->LoadLevel2Data(latestTime, | ||||
|                                                                 request); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                            radarProductManager_->LoadLevel3Data( | ||||
|                               product, latestTime, request); | ||||
|                         } | ||||
|                      } | ||||
|                      else | ||||
|                      catch (const std::exception& ex) | ||||
|                      { | ||||
|                         radarProductManager_->LoadLevel3Data( | ||||
|                            product, latestTime, request); | ||||
|                         logger_->error(ex.what()); | ||||
|                      } | ||||
|                   }); | ||||
|             } | ||||
|  | @ -1672,22 +1679,30 @@ void MapWidgetImpl::InitializeNewRadarProductView( | |||
|    boost::asio::post(threadPool_, | ||||
|                      [=, this]() | ||||
|                      { | ||||
|                         auto radarProductView = context_->radar_product_view(); | ||||
| 
 | ||||
|                         std::string colorTableFile = | ||||
|                            settings::PaletteSettings::Instance() | ||||
|                               .palette(colorPalette) | ||||
|                               .GetValue(); | ||||
|                         if (!colorTableFile.empty()) | ||||
|                         try | ||||
|                         { | ||||
|                            std::unique_ptr<std::istream> colorTableStream = | ||||
|                               util::OpenFile(colorTableFile); | ||||
|                            std::shared_ptr<common::ColorTable> colorTable = | ||||
|                               common::ColorTable::Load(*colorTableStream); | ||||
|                            radarProductView->LoadColorTable(colorTable); | ||||
|                         } | ||||
|                            auto radarProductView = | ||||
|                               context_->radar_product_view(); | ||||
| 
 | ||||
|                         radarProductView->Initialize(); | ||||
|                            std::string colorTableFile = | ||||
|                               settings::PaletteSettings::Instance() | ||||
|                                  .palette(colorPalette) | ||||
|                                  .GetValue(); | ||||
|                            if (!colorTableFile.empty()) | ||||
|                            { | ||||
|                               std::unique_ptr<std::istream> colorTableStream = | ||||
|                                  util::OpenFile(colorTableFile); | ||||
|                               std::shared_ptr<common::ColorTable> colorTable = | ||||
|                                  common::ColorTable::Load(*colorTableStream); | ||||
|                               radarProductView->LoadColorTable(colorTable); | ||||
|                            } | ||||
| 
 | ||||
|                            radarProductView->Initialize(); | ||||
|                         } | ||||
|                         catch (const std::exception& ex) | ||||
|                         { | ||||
|                            logger_->error(ex.what()); | ||||
|                         } | ||||
|                      }); | ||||
| 
 | ||||
|    if (map_ != nullptr) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat