Skip to content
Snippets Groups Projects
Commit 01e88698 authored by Sylvester Joosten's avatar Sylvester Joosten
Browse files

Feat: catch exceptions from algorithms in Juggler

parent 6ac83f14
No related branches found
No related tags found
1 merge request!482Feat: catch exceptions from algorithms in Juggler
......@@ -42,6 +42,8 @@ public:
StatusCode initialize() override {
debug() << "Initializing " << name() << endmsg;
// Algorithms uses exceptions, Gaudi uses StatusCode --> catch and propagate
try {
// Grab the AlgoServiceSvc
m_algo_svc = service("AlgoServiceSvc");
if (!m_algo_svc) {
......@@ -71,6 +73,10 @@ public:
// call the internal algorithm init
debug() << "Initializing underlying algorithm " << m_algo.name() << endmsg;
m_algo.init();
} catch (const std::exception& e) {
fatal() << e.what() << endmsg;
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
......
......@@ -37,6 +37,7 @@ StatusCode AlgoServiceSvc::initialize() {
return sc;
}
try {
auto& serviceSvc = algorithms::ServiceSvc::instance();
info() << "ServiceSvc declared " << serviceSvc.services().size() << " services" << endmsg;
// Always initialize the LogSvc first to ensure proper logging for the others
......@@ -44,8 +45,8 @@ StatusCode AlgoServiceSvc::initialize() {
auto& logger = algorithms::LogSvc::instance();
const algorithms::LogLevel level{
static_cast<algorithms::LogLevel>(msgLevel() > 0 ? msgLevel() - 1 : 0)};
info() << "Setting up algorithms::LogSvc with default level " << algorithms::logLevelName(level)
<< endmsg;
info() << "Setting up algorithms::LogSvc with default level "
<< algorithms::logLevelName(level) << endmsg;
logger.defaultLevel(level);
logger.init(
[this](const algorithms::LogLevel l, std::string_view caller, std::string_view msg) {
......@@ -101,9 +102,8 @@ StatusCode AlgoServiceSvc::initialize() {
}
// Validate our service setup
try {
serviceSvc.validate();
} catch (const algorithms::ServiceError& e) {
} catch (const std::exception& e) {
fatal() << e.what() << endmsg;
return StatusCode::FAILURE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment