CMS 3D CMS Logo

Public Member Functions | Private Attributes

edm::ExceptionCollector Class Reference

#include <ExceptionCollector.h>

List of all members.

Public Member Functions

void addException (cms::Exception const &exception)
void call (boost::function< void(void)>)
 ExceptionCollector (std::string const &initialMessage)
bool hasThrown () const
void rethrow () const
 ~ExceptionCollector ()

Private Attributes

std::auto_ptr< cms::ExceptionaccumulatedExceptions_
std::auto_ptr< cms::ExceptionfirstException_
std::string initialMessage_
int nExceptions_

Detailed Description

Definition at line 34 of file ExceptionCollector.h.


Constructor & Destructor Documentation

edm::ExceptionCollector::ExceptionCollector ( std::string const &  initialMessage)

Definition at line 9 of file ExceptionCollector.cc.

edm::ExceptionCollector::~ExceptionCollector ( )

Definition at line 16 of file ExceptionCollector.cc.

                                          {
  }

Member Function Documentation

void edm::ExceptionCollector::addException ( cms::Exception const &  exception)

Definition at line 59 of file ExceptionCollector.cc.

References accumulatedExceptions_, cms::Exception::clone(), cms::Exception::explainSelf(), firstException_, initialMessage_, and nExceptions_.

Referenced by edm::Schedule::endJob().

                                                                {
    ++nExceptions_;
    if (nExceptions_ == 1) {
      firstException_.reset(exception.clone());
      accumulatedExceptions_.reset(new cms::Exception("MultipleExceptions", initialMessage_));
    }
    *accumulatedExceptions_ << "----- Exception " << nExceptions_ << " -----"
                            << "\n"
                            << exception.explainSelf();
  }
void edm::ExceptionCollector::call ( boost::function< void(void)>  f)
bool edm::ExceptionCollector::hasThrown ( ) const

Definition at line 20 of file ExceptionCollector.cc.

References nExceptions_.

Referenced by edm::SubProcess::endJob().

                                      {
    return nExceptions_ > 0;
  }
void edm::ExceptionCollector::rethrow ( void  ) const

Definition at line 25 of file ExceptionCollector.cc.

References accumulatedExceptions_, firstException_, and nExceptions_.

Referenced by edm::SubProcess::endJob().

                                    {
    if (nExceptions_ == 1) {
      firstException_->raise();
    }
    else if (nExceptions_ > 1) {
      accumulatedExceptions_->raise();
    }
  }

Member Data Documentation

Definition at line 46 of file ExceptionCollector.h.

Referenced by addException(), call(), and rethrow().

Definition at line 45 of file ExceptionCollector.h.

Referenced by addException(), call(), and rethrow().

Definition at line 44 of file ExceptionCollector.h.

Referenced by addException(), and call().

Definition at line 47 of file ExceptionCollector.h.

Referenced by addException(), call(), hasThrown(), and rethrow().