Skip to content

Commit

Permalink
Better exception handling in JFactory
Browse files Browse the repository at this point in the history
Inspired by the failing Podio test cases
  • Loading branch information
nathanwbrei committed May 2, 2024
1 parent d7176d1 commit 32249d1
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions src/libraries/JANA/JFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ void JFactory::Create(const std::shared_ptr<const JEvent>& event) {
if (ex.factory_tag.empty()) ex.factory_tag = mTag;
throw ex;
}
catch (std::exception& e) {
auto ex = JException("Exception in JFactoryT::Init(): %s", e.what());
ex.nested_exception = std::current_exception();
ex.plugin_name = mPluginName;
ex.component_name = mFactoryName;
ex.factory_name = mFactoryName;
ex.factory_tag = mTag;
throw ex;
}
catch (...) {
auto ex = JException("Unknown exception in JFactoryT::Init()");
ex.nested_exception = std::current_exception();
Expand Down Expand Up @@ -63,8 +72,17 @@ void JFactory::Create(const std::shared_ptr<const JEvent>& event) {
if (ex.factory_tag.empty()) ex.factory_tag = mTag;
throw ex;
}
catch (std::exception& e) {
auto ex = JException("Exception in JFactory::BeginRun/ChangeRun/EndRun(): %s", e.what());
ex.nested_exception = std::current_exception();
ex.plugin_name = mPluginName;
ex.component_name = mFactoryName;
ex.factory_name = mFactoryName;
ex.factory_tag = mTag;
throw ex;
}
catch (...) {
auto ex = JException("Unknown exception in JFactoryT::BeginRun/ChangeRun/EndRun()");
auto ex = JException("Unknown exception in JFactory::BeginRun/ChangeRun/EndRun()");
ex.nested_exception = std::current_exception();
ex.plugin_name = mPluginName;
ex.component_name = mFactoryName;
Expand All @@ -82,8 +100,17 @@ void JFactory::Create(const std::shared_ptr<const JEvent>& event) {
if (ex.factory_tag.empty()) ex.factory_tag = mTag;
throw ex;
}
catch (std::exception& e) {
auto ex = JException("Exception in JFactory::Process(): %s", e.what());
ex.nested_exception = std::current_exception();
ex.plugin_name = mPluginName;
ex.component_name = mFactoryName;
ex.factory_name = mFactoryName;
ex.factory_tag = mTag;
throw ex;
}
catch (...) {
auto ex = JException("Unknown exception in JFactoryT::Process()");
auto ex = JException("Unknown exception in JFactory::Process()");
ex.nested_exception = std::current_exception();
ex.plugin_name = mPluginName;
ex.component_name = mFactoryName;
Expand Down

0 comments on commit 32249d1

Please sign in to comment.