CMS 3D CMS Logo

resolverMaker.cc
Go to the documentation of this file.
2 
3 namespace edm::detail {
5  std::string const& modtype,
6  ModuleTypeResolverBase const* resolver) {
7  if (not resolver) {
8  throw except;
9  }
10  //if needed, create list of alternative types that were tried
11  std::string alternativeTypes;
12  auto index = resolver->kInitialIndex;
13  auto newType = modtype;
14  int tries = 0;
15  do {
16  ++tries;
17  if (not alternativeTypes.empty()) {
18  alternativeTypes.append(", ");
19  }
20  auto [ttype, tindex] = resolver->resolveType(std::move(newType), index);
21  newType = std::move(ttype);
22  index = tindex;
23  alternativeTypes.append(newType);
24  } while (index != resolver->kLastIndex);
25  if (tries == 1 and alternativeTypes == modtype) {
26  throw except;
27  }
28  alternativeTypes.insert(0, "These alternative types were tried: ");
29  except.addAdditionalInfo(alternativeTypes);
30  throw except;
31  }
32 } // namespace edm::detail
void annotateResolverMakerExceptionAndRethrow(cms::Exception &except, std::string const &modtype, ModuleTypeResolverBase const *resolver)
Definition: resolverMaker.cc:4
void addAdditionalInfo(std::string const &info)
Definition: Exception.cc:169
def move(src, dest)
Definition: eostools.py:511