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 {
37  try {
38  f();
39  }
40  catch (cms::Exception& e) { throw; }
41  catch (std::bad_alloc& bda) { convertException::badAllocToEDM(); }
44  catch (char const* c) { convertException::charPtrToEDM(c); }
45  catch (...) { convertException::unknownToEDM(); }
46  }
47  catch (cms::Exception const& ex) {
48  ++nExceptions_;
49  if (nExceptions_ == 1) {
50  firstException_.reset(ex.clone());
51  accumulatedExceptions_.reset(new cms::Exception("MultipleExceptions", initialMessage_));
52  }
54  << ex.explainSelf();
55  }
56  }
57 
58  void
60  ++nExceptions_;
61  if (nExceptions_ == 1) {
62  firstException_.reset(exception.clone());
63  accumulatedExceptions_.reset(new cms::Exception("MultipleExceptions", initialMessage_));
64  }
65  *accumulatedExceptions_ << "----- Exception " << nExceptions_ << " -----"
66  << "\n"
67  << exception.explainSelf();
68  }
69 }
void addException(cms::Exception const &exception)
virtual std::string explainSelf() const
Definition: Exception.cc:146
void call(boost::function< void(void)>)
void stdToEDM(std::exception const &e)
helper::RootFunctionHelper< F, args >::root_function function(F &f)
Definition: rootFunction.h:14
std::auto_ptr< cms::Exception > accumulatedExceptions_
double f[11][100]
void charPtrToEDM(char const *c)
void stringToEDM(std::string &s)
ExceptionCollector(std::string const &initialMessage)
virtual Exception * clone() const
Definition: Exception.cc:259
std::auto_ptr< cms::Exception > firstException_