Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates in the spatialtiledlocaldomaincontroller.cpp #91

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 32 additions & 16 deletions Source/moja.flint/src/spatialtiledlocaldomaincontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,25 +792,27 @@ bool SpatialTiledLocalDomainController::runCellSpinUp(std::shared_ptr<StatsUnitR
blockStatsUnit->_unitsProcessed++;
return true;
} catch (const flint::SimulationError& e) {
std::string details = *(boost::get_error_info<Details>(e));
std::string libraryName = *(boost::get_error_info<LibraryName>(e));
std::string moduleName = *(boost::get_error_info<ModuleName>(e));
const int* errorCode = boost::get_error_info<ErrorCode>(e);
_spatiallocationinfo->_errorCode = *errorCode;
_spatiallocationinfo->_library = libraryName;
_spatiallocationinfo->_module = moduleName;
_spatiallocationinfo->_message = details;
//std::string details = *(boost::get_error_info<Details>(e));
//std::string libraryName = *(boost::get_error_info<LibraryName>(e));
//std::string moduleName = *(boost::get_error_info<ModuleName>(e));
//const int* errorCode = boost::get_error_info<ErrorCode>(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<Details>(e));
std::string libraryName = *(boost::get_error_info<LibraryName>(e));
std::string moduleName = *(boost::get_error_info<ModuleName>(e));
const int* errorCode = boost::get_error_info<ErrorCode>(e);
_spatiallocationinfo->_errorCode = *errorCode;
_spatiallocationinfo->_library = libraryName;
_spatiallocationinfo->_module = moduleName;
_spatiallocationinfo->_message = details;
//std::string details = *(boost::get_error_info<Details>(e));
//std::string libraryName = *(boost::get_error_info<LibraryName>(e));
//std::string moduleName = *(boost::get_error_info<ModuleName>(e));
//const int* errorCode = boost::get_error_info<ErrorCode>(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 =
Expand Down Expand Up @@ -844,6 +846,20 @@ bool SpatialTiledLocalDomainController::runCellSpinUp(std::shared_ptr<StatsUnitR
}
return true;
}
// Here this template function will handle all the string and spatiallocationinfo for
//both the LocalDomainError and SimulationError. From lines 794-816.
template <typename FlintExceptionType&>
std::string _handleFLINTException(const FlintExceptionType& e) {
std::string details = *(boost::get_error_info<Details>(e));
std::string libraryName = *(boost::get_error_info<LibraryName>(e));
std::string moduleName = *(boost::get_error_info<ModuleName>(e));
const int* errorCode = boost::get_error_info<ErrorCode>(e);
_spatiallocationinfo->_errorCode = *errorCode;
_spatiallocationinfo->_library = libraryName;
_spatiallocationinfo->_module = moduleName;
_spatiallocationinfo->_message = details;
return details;
}

// --------------------------------------------------------------------------------------------

Expand Down