CMS 3D CMS Logo

ExceptionActions.cc
Go to the documentation of this file.
1 
5 
6 #include <vector>
7 #include <iostream>
8 
9 namespace edm {
10  namespace exception_actions {
11  namespace {
12  struct ActionNames {
13  ActionNames() : table_(LastCode + 1) {
14  table_[IgnoreCompletely] = "IgnoreCompletely";
15  table_[Rethrow] = "Rethrow";
16  table_[SkipEvent] = "SkipEvent";
17  table_[FailPath] = "FailPath";
18  }
19 
20  typedef std::vector<char const*> Table;
22  };
23  } // namespace
24 
25  char const* actionName(ActionCodes code) {
26  static ActionNames tab;
27  return static_cast<unsigned int>(code) < tab.table_.size() ? tab.table_[code] : "UnknownAction";
28  }
29  } // namespace exception_actions
30 
32 
33  namespace {
34  inline void install(exception_actions::ActionCodes code,
36  ParameterSet const& pset) {
37  typedef std::vector<std::string> vstring;
38 
39  // we cannot have parameters in the main process section so look
40  // for an untracked (optional) ParameterSet called "options" for
41  // now. Notice that all exceptions (most actally) throw
42  // edm::Exception with the configuration category. This
43  // category should probably be more specific or a derived
44  // exception type should be used so the catch can be more
45  // specific.
46 
47  // cerr << pset.toString() << std::endl;
48 
49  ParameterSet const& opts = pset.getUntrackedParameterSet("options");
50  //cerr << "looking for " << actionName(code) << std::endl;
51  for (auto const& v : opts.getUntrackedParameter<std::vector<std::string>>(actionName(code))) {
52  out[v] = code;
53  }
54  }
55  } // namespace
56 
58  addDefaults();
59 
64  }
65 
67  // populate defaults that are not 'Rethrow'
68  // (There are none as of CMSSW_3_4_X.)
69  // 'Rethrow' is the default default.
70  if (2 <= debugit()) {
71  ActionMap::const_iterator ib(map_.begin()), ie(map_.end());
72  for (; ib != ie; ++ib) {
73  std::cerr << ib->first << ',' << ib->second << '\n';
74  }
75  std::cerr << std::endl;
76  }
77  }
78 
80 
82  map_[category] = code;
83  }
84 
86  ActionMap::const_iterator i(map_.find(category));
87  return i != map_.end() ? i->second : exception_actions::Rethrow;
88  }
89 
90 } // namespace edm
taus_updatedMVAIds_cff.category
category
Definition: taus_updatedMVAIds_cff.py:30
edm::exception_actions::actionName
const char * actionName(ActionCodes code)
Definition: ExceptionActions.cc:25
mps_fire.i
i
Definition: mps_fire.py:355
edm::exception_actions::LastCode
Definition: ExceptionActions.h:11
edm::exception_actions::Rethrow
Definition: ExceptionActions.h:11
edm
HLT enums.
Definition: AlignableModifier.h:19
Algorithms.h
edm::ExceptionToActionTable::map_
ActionMap map_
Definition: ExceptionActions.h:29
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::ExceptionToActionTable::add
void add(const std::string &category, exception_actions::ActionCodes code)
Definition: ExceptionActions.cc:81
edm::debugit
debugvalue debugit
Definition: DebugMacros.cc:10
Table
edm::vstring
std::vector< std::string > vstring
Definition: Schedule.cc:580
edm::exception_actions::FailPath
Definition: ExceptionActions.h:11
edm::exception_actions::SkipEvent
Definition: ExceptionActions.h:11
edm::ExceptionToActionTable::addDefaults
void addDefaults()
Definition: ExceptionActions.cc:66
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
ExceptionActions.h
cuy.ib
ib
Definition: cuy.py:662
edm::ExceptionToActionTable::ExceptionToActionTable
ExceptionToActionTable()
Definition: ExceptionActions.cc:31
edm::ExceptionToActionTable::~ExceptionToActionTable
~ExceptionToActionTable()
Definition: ExceptionActions.cc:79
edm::ExceptionToActionTable::ActionMap
std::map< std::string, exception_actions::ActionCodes > ActionMap
Definition: ExceptionActions.h:18
edm::ExceptionToActionTable::find
exception_actions::ActionCodes find(const std::string &category) const
Definition: ExceptionActions.cc:85
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
DebugMacros.h
edm::exception_actions::IgnoreCompletely
Definition: ExceptionActions.h:11
table_
Table table_
Definition: ExceptionActions.cc:21
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
geometryDiff.opts
opts
Definition: geometryDiff.py:11
edm::exception_actions::ActionCodes
ActionCodes
Definition: ExceptionActions.h:11