CMS 3D CMS Logo

ExceptionCollector.cc
Go to the documentation of this file.
4 
5 #include <exception>
6 
7 namespace edm {
8 
10  public:
11  MultipleException(int iReturnValue,
12  std::string const& iMessage):
13  cms::Exception("MultipleExceptions", iMessage),
14  returnValue_(iReturnValue) {}
15 
16  virtual Exception* clone() const override {
17  return new MultipleException(*this);
18  }
19 
20  private:
21  int returnCode_() const override {
22  return returnValue_;
23  }
24 
26  };
27 
29  initialMessage_(initialMessage),
30  firstException_(),
31  accumulatedExceptions_(),
32  nExceptions_(0) {
33  }
34 
36  }
37 
38  bool
40  return nExceptions_ > 0;
41  }
42 
43  void
45  if (nExceptions_ == 1) {
46  firstException_->raise();
47  }
48  else if (nExceptions_ > 1) {
49  accumulatedExceptions_->raise();
50  }
51  }
52 
53  void
55  try {
57  f();
58  });
59  }
60  catch (cms::Exception const& ex) {
61  ++nExceptions_;
62  if (nExceptions_ == 1) {
63  firstException_.reset(ex.clone());
65  }
67  << ex.explainSelf();
68  }
69  }
70 
71  void
73  ++nExceptions_;
74  if (nExceptions_ == 1) {
75  firstException_.reset(exception.clone());
77  }
78  *accumulatedExceptions_ << "----- Exception " << nExceptions_ << " -----"
79  << "\n"
80  << exception.explainSelf();
81  }
82 }
void addException(cms::Exception const &exception)
std::unique_ptr< cms::Exception > firstException_
virtual std::string explainSelf() const
Definition: Exception.cc:146
double f[11][100]
int returnCode_() const override
int returnCode() const
Definition: Exception.cc:199
std::unique_ptr< cms::Exception > accumulatedExceptions_
ExceptionCollector(std::string const &initialMessage)
HLT enums.
virtual Exception * clone() const override
auto wrap(F iFunc) -> decltype(iFunc())
void call(std::function< void(void)>)
MultipleException(int iReturnValue, std::string const &iMessage)
virtual Exception * clone() const
Definition: Exception.cc:259