CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ExceptionCollector.cc
Go to the documentation of this file.
4 
5 #include <exception>
6 
7 namespace edm {
8 
10  initialMessage_(initialMessage),
11  firstException_(),
12  accumulatedExceptions_(),
13  nExceptions_(0) {
14  }
15 
17  }
18 
19  bool
21  return nExceptions_ > 0;
22  }
23 
24  void
26  if (nExceptions_ == 1) {
27  firstException_->raise();
28  }
29  else if (nExceptions_ > 1) {
30  accumulatedExceptions_->raise();
31  }
32  }
33 
34  void
36  try {
38  f();
39  });
40  }
41  catch (cms::Exception const& ex) {
42  ++nExceptions_;
43  if (nExceptions_ == 1) {
44  firstException_.reset(ex.clone());
45  accumulatedExceptions_.reset(new cms::Exception("MultipleExceptions", initialMessage_));
46  }
48  << ex.explainSelf();
49  }
50  }
51 
52  void
54  ++nExceptions_;
55  if (nExceptions_ == 1) {
56  firstException_.reset(exception.clone());
57  accumulatedExceptions_.reset(new cms::Exception("MultipleExceptions", initialMessage_));
58  }
59  *accumulatedExceptions_ << "----- Exception " << nExceptions_ << " -----"
60  << "\n"
61  << exception.explainSelf();
62  }
63 }
void addException(cms::Exception const &exception)
virtual std::string explainSelf() const
Definition: Exception.cc:146
void call(boost::function< void(void)>)
helper::RootFunctionHelper< F, args >::root_function function(F &f)
Definition: rootFunction.h:14
std::auto_ptr< cms::Exception > accumulatedExceptions_
double f[11][100]
ExceptionCollector(std::string const &initialMessage)
auto wrap(F iFunc) -> decltype(iFunc())
virtual Exception * clone() const
Definition: Exception.cc:259
std::auto_ptr< cms::Exception > firstException_