diff --git a/include/appfwk/detail/DAQModule.hxx b/include/appfwk/detail/DAQModule.hxx index 003c351..27c03c9 100644 --- a/include/appfwk/detail/DAQModule.hxx +++ b/include/appfwk/detail/DAQModule.hxx @@ -45,6 +45,7 @@ make_module(std::string const& plugin_name, std::string const& instance_name) try { mod_ptr = bpf.makePlugin>(plugin_name, instance_name); } catch (const cet::exception& cexpt) { + ers::error(DAQModuleCreationFailed(ERS_HERE, plugin_name, instance_name, cexpt)); throw DAQModuleCreationFailed(ERS_HERE, plugin_name, instance_name, cexpt); } return mod_ptr; diff --git a/unittest/DAQModule_test.cxx b/unittest/DAQModule_test.cxx index d89f536..f6d9195 100644 --- a/unittest/DAQModule_test.cxx +++ b/unittest/DAQModule_test.cxx @@ -124,9 +124,14 @@ BOOST_AUTO_TEST_CASE(Commands) BOOST_AUTO_TEST_CASE(MakeModule) { - BOOST_REQUIRE_EXCEPTION(make_module("not_a_real_plugin_name", "error_test"), - DAQModuleCreationFailed, - [&](DAQModuleCreationFailed) { return true; }); + BOOST_REQUIRE_EXCEPTION( + make_module("not_a_valid_plugin_name", "error_test"), DAQModuleCreationFailed, [&](DAQModuleCreationFailed e) { + return e.cause()->message().find("contains an illegal underscore") != std::string::npos; + }); + BOOST_REQUIRE_EXCEPTION( + make_module("not-a-real-plugin-name", "error_test"), DAQModuleCreationFailed, [&](DAQModuleCreationFailed e) { + return e.cause()->message().find("does not correspond to any library") != std::string::npos; + }); } BOOST_AUTO_TEST_CASE(RegisterCommand)