diff --git a/Source/moja.flint/src/spatialtiledlocaldomaincontroller.cpp b/Source/moja.flint/src/spatialtiledlocaldomaincontroller.cpp index 6ac1ca7..827c85f 100644 --- a/Source/moja.flint/src/spatialtiledlocaldomaincontroller.cpp +++ b/Source/moja.flint/src/spatialtiledlocaldomaincontroller.cpp @@ -792,25 +792,11 @@ bool SpatialTiledLocalDomainController::runCellSpinUp(std::shared_ptr_unitsProcessed++; return true; } catch (const flint::SimulationError& e) { - std::string details = *(boost::get_error_info
(e)); - std::string libraryName = *(boost::get_error_info(e)); - std::string moduleName = *(boost::get_error_info(e)); - const int* errorCode = boost::get_error_info(e); - _spatiallocationinfo->_errorCode = *errorCode; - _spatiallocationinfo->_library = libraryName; - _spatiallocationinfo->_module = moduleName; - _spatiallocationinfo->_message = details; + std::string details = _handleFLINTException(e); // Template function call _spinupNotificationCenter.postNotification(moja::signals::Error, details); return true; } catch (const flint::LocalDomainError& e) { - std::string details = *(boost::get_error_info
(e)); - std::string libraryName = *(boost::get_error_info(e)); - std::string moduleName = *(boost::get_error_info(e)); - const int* errorCode = boost::get_error_info(e); - _spatiallocationinfo->_errorCode = *errorCode; - _spatiallocationinfo->_library = libraryName; - _spatiallocationinfo->_module = moduleName; - _spatiallocationinfo->_message = details; + std::string details = _handleFLINTException(e); // Template function call _spinupNotificationCenter.postNotification(moja::signals::Error, details); } catch (flint::VariableNotFoundException& e) { std::string str = @@ -844,6 +830,20 @@ bool SpatialTiledLocalDomainController::runCellSpinUp(std::shared_ptr +std::string _handleFLINTException(const FlintExceptionType& e) { + std::string details = *(boost::get_error_info
(e)); + std::string libraryName = *(boost::get_error_info(e)); + std::string moduleName = *(boost::get_error_info(e)); + const int* errorCode = boost::get_error_info(e); + _spatiallocationinfo->_errorCode = *errorCode; + _spatiallocationinfo->_library = libraryName; + _spatiallocationinfo->_module = moduleName; + _spatiallocationinfo->_message = details; + return details; +} // -------------------------------------------------------------------------------------------- @@ -929,17 +929,10 @@ bool SpatialTiledLocalDomainController::runCell(std::shared_ptr } } - // This error is recoverable, retunr true for success + // This error is recoverable, return true for success catch (const flint::SimulationError& e) { // This error is recoverable, drop cell and continue simulation - std::string details = *(boost::get_error_info
(e)); - std::string libraryName = *(boost::get_error_info(e)); - std::string moduleName = *(boost::get_error_info(e)); - const int* errorCode = boost::get_error_info(e); - _spatiallocationinfo->_errorCode = *errorCode; - _spatiallocationinfo->_library = libraryName; - _spatiallocationinfo->_module = moduleName; - _spatiallocationinfo->_message = details; + std::string details = _handleFLINTException(e); // Template function call _notificationCenter.postNotification(moja::signals::Error, details); blockStatsUnit->_unitsNotProcessed++; blockStatsUnit->_unitsWithError++; @@ -947,14 +940,7 @@ bool SpatialTiledLocalDomainController::runCell(std::shared_ptr } // All other catches are failures for the localdomain, return false! catch (const flint::LocalDomainError& e) { - std::string details = *(boost::get_error_info
(e)); - std::string libraryName = *(boost::get_error_info(e)); - std::string moduleName = *(boost::get_error_info(e)); - const int* errorCode = boost::get_error_info(e); - _spatiallocationinfo->_errorCode = *errorCode; - _spatiallocationinfo->_library = libraryName; - _spatiallocationinfo->_module = moduleName; - _spatiallocationinfo->_message = details; + std::string details = _handleFLINTException(e); // Template function call _notificationCenter.postNotification(moja::signals::Error, details); } catch (flint::VariableNotFoundException& e) { std::string str = ((boost::format("Variable not found: %1%") % *(boost::get_error_info(e))).str());