diff --git a/FWCore/ParameterSet/src/Entry.cc b/FWCore/ParameterSet/src/Entry.cc index 6092c44d6c5ea..83a82a612f29a 100644 --- a/FWCore/ParameterSet/src/Entry.cc +++ b/FWCore/ParameterSet/src/Entry.cc @@ -391,8 +391,9 @@ namespace edm { } default: { // We should never get here. - assert("Invalid type code" == nullptr); - //throw EntryError(std::string("invalid type code ") + type); + throw edm::Exception(edm::errors::Configuration) << "Unknown ParameterSet Entry type encoding: '" << type + << "'.\n This could be caused by reading a file which was " + "written using a newer incompatible software release."; break; } } // switch(type) diff --git a/IOPool/Input/src/RootFile.cc b/IOPool/Input/src/RootFile.cc index f0242b9721cf2..2e90fef497cc6 100644 --- a/IOPool/Input/src/RootFile.cc +++ b/IOPool/Input/src/RootFile.cc @@ -414,12 +414,23 @@ namespace edm { } else { // Merge into the parameter set registry. pset::Registry& psetRegistry = *pset::Registry::instance(); - for (auto const& psetEntry : psetMap) { - ParameterSet pset(psetEntry.second.pset()); - pset.setID(psetEntry.first); - // For thread safety, don't update global registries when a secondary source opens a file. - if (inputType != InputType::SecondarySource) { - psetRegistry.insertMapped(pset); + try { + for (auto const& psetEntry : psetMap) { + ParameterSet pset(psetEntry.second.pset()); + pset.setID(psetEntry.first); + // For thread safety, don't update global registries when a secondary source opens a file. + if (inputType != InputType::SecondarySource) { + psetRegistry.insertMapped(pset); + } + } + } catch (edm::Exception const& iExcept) { + if (iExcept.categoryCode() == edm::errors::Configuration) { + edm::Exception exception(edm::errors::FormatIncompatibility); + exception << iExcept.message(); + exception.addContext("Creating ParameterSets from file"); + throw exception; + } else { + throw; } } }