FWCore
Framework
src
ExceptionActions.cc
Go to the documentation of this file.
1
2
#include "
FWCore/Framework/interface/ExceptionActions.h
"
3
#include "
FWCore/Utilities/interface/DebugMacros.h
"
4
#include "
FWCore/Utilities/interface/Algorithms.h
"
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
;
21
Table
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
31
ExceptionToActionTable::ExceptionToActionTable
() : map_() {
addDefaults
(); }
32
33
namespace
{
34
inline
void
install(
exception_actions::ActionCodes
code,
35
ExceptionToActionTable::ActionMap
&
out
,
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
57
ExceptionToActionTable::ExceptionToActionTable
(
ParameterSet
const
&
pset
) : map_() {
58
addDefaults
();
59
60
install(
exception_actions::SkipEvent
,
map_
,
pset
);
61
install(
exception_actions::Rethrow
,
map_
,
pset
);
62
install(
exception_actions::IgnoreCompletely
,
map_
,
pset
);
63
install(
exception_actions::FailPath
,
map_
,
pset
);
64
}
65
66
void
ExceptionToActionTable::addDefaults
() {
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
79
ExceptionToActionTable::~ExceptionToActionTable
() {}
80
81
void
ExceptionToActionTable::add
(
std::string
const
&
category
,
exception_actions::ActionCodes
code) {
82
map_
[
category
] = code;
83
}
84
85
exception_actions::ActionCodes
ExceptionToActionTable::find
(
std::string
const
&
category
)
const
{
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:31
edm::exception_actions::actionName
const char * actionName(ActionCodes code)
Definition:
ExceptionActions.cc:25
mps_fire.i
i
Definition:
mps_fire.py:428
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:654
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
edm::ParameterSet
Definition:
ParameterSet.h:47
ExceptionActions.h
cuy.ib
ib
Definition:
cuy.py:661
edm::ExceptionToActionTable::ExceptionToActionTable
ExceptionToActionTable()
Definition:
ExceptionActions.cc:31
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
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
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition:
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
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
Generated for CMSSW Reference Manual by
1.8.16