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

Improve exception message for missing produces call #13521

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 19 additions & 10 deletions FWCore/Framework/src/PrincipalGetAdapter.cc
Expand Up @@ -225,17 +225,26 @@ namespace edm {
ProductHolderIndexHelper const& productHolderIndexHelper = principal_.productLookup();
ProductHolderIndex index = productHolderIndexHelper.index(PRODUCT_TYPE, type, md_.moduleLabel().c_str(),productInstanceName.c_str(), md_.processName().c_str());
if(index == ProductHolderIndexInvalid) {
std::ostringstream str;
for(auto branchDescription: principal_.productRegistry().allBranchDescriptions()) {
if (branchDescription->moduleLabel() == md_.moduleLabel() and branchDescription->processName() == md_.processName()) {
str << *branchDescription<< "-----\n";
}
}
throw edm::Exception(edm::errors::InsertFailure)
<< "Illegal attempt to 'put' an unregistered product.\n"
<< "No product is registered for\n"
<< " product friendly class name: '" << type.friendlyClassName() << "'\n"
<< " module label: '" << md_.moduleLabel() << "'\n"
<< " product instance name: '" << productInstanceName << "'\n"
<< " process name: '" << md_.processName() << "'\n"

<< "The ProductRegistry contains:\n"
<< principal_.productRegistry()
<< '\n';
<< "Illegal attempt to 'put' an unregistered product.\n"
<< "No product is registered for\n"
<< " product friendly class name: '" << type.friendlyClassName() << "'\n"
<< " module label: '" << md_.moduleLabel() << "'\n"
<< " product instance name: '" << productInstanceName << "'\n"
<< " process name: '" << md_.processName() << "'\n"

<< "The following data products are registered for production by "<<md_.moduleLabel()<<":\n"
<< str.str()
<< '\n'
<< "To correct the problem:\n"
" 1) make sure the proper 'produce' call is being made in the module's constructor,\n"
" 2) if 'produce' exists and uses a product instance name make sure that same name is used during the 'put' call.";
}
ProductHolderBase const* phb = principal_.getProductHolderByIndex(index);
assert(phb != nullptr);
Expand Down