CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Friends

cms::Exception Class Reference

#include <Exception.h>

Inheritance diagram for cms::Exception:
Clustering1DException CMSexception cond::Exception DetLayerException edm::eventsetup::MakeDataException edm::eventsetup::NoDataExceptionBase edm::eventsetup::NoRecordException< T > edm::Exception edm::ProductDeletedException edm::UnknownModuleException LinPtException MeasurementDetException ora::Exception popcon::Exception PropagationException RPCException StatisticsException StripClusterizerAlgorithm::InvalidChargeException TrajectoryStateException

List of all members.

Public Member Functions

void addAdditionalInfo (std::string const &info)
void addAdditionalInfo (char const *info)
void addContext (std::string const &context)
void addContext (char const *context)
std::list< std::string > const & additionalInfo () const
bool alreadyPrinted () const
void append (Exception const &another)
void append (std::string const &more_information)
void append (char const *more_information)
std::string const & category () const
void clearAdditionalInfo ()
void clearContext ()
void clearMessage ()
virtual Exceptionclone () const
std::list< std::string > const & context () const
 Exception (char const *aCategory)
 Exception (std::string const &aCategory, std::string const &message)
 Exception (std::string const &aCategory, char const *message)
 Exception (std::string const &aCategory)
 Exception (char const *aCategory, char const *message)
 Exception (Exception const &other)
 Exception (char const *aCategory, std::string const &message)
 Exception (std::string const &aCategory, std::string const &message, Exception const &another)
virtual std::string explainSelf () const
std::list< std::string > history () const
std::string message () const
Exceptionoperator= (Exception const &other)
void raise ()
int returnCode () const
void setAdditionalInfo (std::list< std::string > const &info)
void setAlreadyPrinted (bool value)
void setContext (std::list< std::string > const &context)
void swap (Exception &other)
virtual char const * what () const throw ()
virtual ~Exception () throw ()

Private Member Functions

void init (std::string const &message)
virtual void rethrow ()
virtual int returnCode_ () const

Private Attributes

std::list< std::string > additionalInfo_
bool alreadyPrinted_
std::string category_
std::list< std::string > context_
std::ostringstream ost_
std::string what_

Friends

template<typename E , typename T >
detail::Desired< E,
detail::is_derived_or_same
< Exception, E >::value >
::type
operator<< (E &e, T const &stuff)
template<typename E >
detail::Desired< E,
detail::is_derived_or_same
< Exception, E >::value >
::type const & 
operator<< (E const &e, std::ios_base &(*f)(std::ios_base &))
template<typename E >
detail::Desired< E,
detail::is_derived_or_same
< Exception, E >::value >
::type
operator<< (E &e, std::ios_base &(*f)(std::ios_base &))
template<typename E >
detail::Desired< E,
detail::is_derived_or_same
< Exception, E >::value >
::type const & 
operator<< (E const &e, std::ostream &(*f)(std::ostream &))
template<typename E >
detail::Desired< E,
detail::is_derived_or_same
< Exception, E >::value >
::type
operator<< (E &e, std::ostream &(*f)(std::ostream &))
template<typename E , typename T >
detail::Desired< E,
detail::is_derived_or_same
< Exception, E >::value >
::type const & 
operator<< (E const &e, T const &stuff)

Detailed Description

Definition at line 66 of file Exception.h.


Constructor & Destructor Documentation

Exception::Exception ( std::string const &  aCategory) [explicit]

Reimplemented in cond::Exception, and popcon::Exception.

Definition at line 6 of file Exception.cc.

Referenced by clone().

                                                 :
    std::exception(),
    ost_(),
    category_(aCategory),
    what_(),
    context_(),
    additionalInfo_(),
    alreadyPrinted_(false)
  {
  }
Exception::Exception ( char const *  aCategory) [explicit]

Definition at line 17 of file Exception.cc.

                                             :
    std::exception(),
    ost_(),
    category_(std::string(aCategory)),
    what_(),
    context_(),
    additionalInfo_(),
    alreadyPrinted_(false)
  {
  }
Exception::Exception ( std::string const &  aCategory,
std::string const &  message 
)

Reimplemented in ora::Exception.

Definition at line 28 of file Exception.cc.

References init().

Exception::Exception ( char const *  aCategory,
std::string const &  message 
)

Definition at line 41 of file Exception.cc.

References init().

                                                 :
    std::exception(),
    ost_(),
    category_(std::string(aCategory)),
    what_(),
    context_(),
    additionalInfo_(),
    alreadyPrinted_(false)
  {
    init(message);
  }
Exception::Exception ( std::string const &  aCategory,
char const *  message 
)

Definition at line 55 of file Exception.cc.

References init().

                                            :
    std::exception(),
    ost_(),
    category_(aCategory),
    what_(),
    context_(),
    additionalInfo_(),
    alreadyPrinted_(false)
  {
    init(std::string(message));
  }
Exception::Exception ( char const *  aCategory,
char const *  message 
)

Definition at line 69 of file Exception.cc.

References init().

                                            :
    std::exception(),
    ost_(),
    category_(std::string(aCategory)),
    what_(),
    context_(),
    additionalInfo_(),
    alreadyPrinted_(false)
  {
    init(std::string(message));
  }
Exception::Exception ( std::string const &  aCategory,
std::string const &  message,
Exception const &  another 
)

Definition at line 90 of file Exception.cc.

References append(), message(), and ost_.

                                                 :
    std::exception(),
    ost_(),
    category_(aCategory),
    what_(),
    context_(another.context()),
    additionalInfo_(another.additionalInfo()),
    alreadyPrinted_(false)
  {
    ost_ << message;
    // check for newline at end of message first
    if(!message.empty() && message[message.size()-1]!='\n') {
      ost_ << "\n";
    }
    append(another);
  }
Exception::Exception ( Exception const &  other)

Definition at line 109 of file Exception.cc.

References ost_.

                                            :
    std::exception(),
    ost_(),
    category_(other.category_),
    what_(other.what_),
    context_(other.context_),
    additionalInfo_(other.additionalInfo_),
    alreadyPrinted_(other.alreadyPrinted_)
  {
    ost_ << other.ost_.str();
  }
Exception::~Exception ( ) throw () [virtual]

Reimplemented in cond::Exception, ora::Exception, popcon::Exception, and edm::Exception.

Definition at line 121 of file Exception.cc.

                                {
  }

Member Function Documentation

void Exception::addAdditionalInfo ( std::string const &  info)

Definition at line 235 of file Exception.cc.

References additionalInfo_.

Referenced by XrdFile::addConnection(), edm::Path::handleWorkerFailure(), and StorageFactory::open().

                                                         {
    additionalInfo_.push_back(info);
  }
void Exception::addAdditionalInfo ( char const *  info)

Definition at line 239 of file Exception.cc.

References additionalInfo_.

                                                    {
    additionalInfo_.push_back(std::string(info));
  }
void Exception::addContext ( char const *  context)

Definition at line 231 of file Exception.cc.

References context_.

                                                {
    context_.push_back(std::string(context));
  }
void Exception::addContext ( std::string const &  context)

Definition at line 227 of file Exception.cc.

References context_.

Referenced by edm::addContextAndPrintException(), edm::eventsetup::ComponentFactory< T >::addTo(), edm::eventsetup::EventSetupRecord::addTraceInfoToCmsException(), L1GlobalTriggerObjectMaps::algorithmResult(), L1GlobalTriggerObjectMaps::AlgorithmResult::AlgorithmResult(), CompareToObjectMapRecord::analyze(), edm::Worker::beginJob(), L1GlobalTriggerObjectMaps::consistencyCheck(), edm::serviceregistry::ServicesManager::createServices(), edm::EDLooperBase::doDuringLoop(), edm::Worker::endJob(), edm::Path::exceptionContext(), L1GlobalTriggerObjectMaps::getCombinationsInCondition(), L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::getConditionResult(), edm::RootTree::getEntry(), L1GlobalTriggerObjectMaps::CombinationsInCondition::getObjectIndex(), L1GlobalTriggerObjectMaps::getStartEndIndex(), edm::makeInput(), StorageFactory::open(), DCacheFile::open(), XrdFile::open(), RFIOFile::open(), edm::StreamerInputFile::openStreamerFile(), XrdFile::position(), DCacheFile::position(), RFIOFile::position(), edm::Schedule::processOneOccurrence(), ConvertObjectMapRecord::produce(), RFIOFile::read(), DCacheFile::read(), XrdFile::read(), edm::StreamerInputFile::readBytes(), DCacheFile::readv(), XrdFile::readv(), XrdFile::resize(), edm::UnscheduledCallProducer::runNow(), DQMRootSource::setupFile(), edm::StreamerInputFile::skipBytes(), RFIOStorageMaker::stagein(), DCacheStorageMaker::stagein(), edm::Maker::throwConfigurationException(), throwStorageError(), edm::Maker::throwValidationException(), edm::UnscheduledCallProducer::tryToFillImpl(), L1GlobalTriggerObjectMaps::updateOperandTokenVector(), edm::eventsetup::validateEventSetupParameters(), XrdFile::write(), DCacheFile::write(), RFIOFile::write(), and edm::RootOutputFile::writeIndexIntoFile().

                                                     {
    context_.push_back(context);
  }
std::list< std::string > const & Exception::additionalInfo ( ) const

Definition at line 195 of file Exception.cc.

References additionalInfo_.

                                                            {
    return additionalInfo_;
  }
bool Exception::alreadyPrinted ( ) const

Definition at line 251 of file Exception.cc.

References alreadyPrinted_.

                                       {
    return alreadyPrinted_;
  }
void Exception::append ( Exception const &  another)
void Exception::append ( std::string const &  more_information)

Definition at line 207 of file Exception.cc.

References ost_.

                                                          {
    ost_ << more_information;
  }
void Exception::append ( char const *  more_information)

Definition at line 211 of file Exception.cc.

References ost_.

                                                     {
    ost_ << more_information;
  }
std::string const & Exception::category ( void  ) const
void Exception::clearAdditionalInfo ( )

Definition at line 223 of file Exception.cc.

References additionalInfo_.

                                      {
    additionalInfo_.clear();
  }
void Exception::clearContext ( )

Definition at line 219 of file Exception.cc.

References context_.

                               {
    context_.clear();
  }
void Exception::clearMessage ( )

Definition at line 215 of file Exception.cc.

References ost_.

Referenced by StorageFactory::open(), and edm::StreamerInputFile::openStreamerFile().

                               {
    ost_.str("");
  }
Exception * Exception::clone ( void  ) const [virtual]

Reimplemented in edm::Exception, Fastexception, BaseGenexception, and Genexception.

Definition at line 259 of file Exception.cc.

References Exception().

Referenced by edm::ExceptionCollector::addException(), and edm::ExceptionCollector::call().

                                    {
    return new Exception(*this);
  }
std::list< std::string > const & Exception::context ( ) const

Definition at line 191 of file Exception.cc.

References context_.

Referenced by edm::Schedule::processOneOccurrence(), and setContext().

                                                     {
    return context_;
  }
std::string Exception::explainSelf ( void  ) const [virtual]

Reimplemented in CMSexception, and Fastexception.

Definition at line 146 of file Exception.cc.

References additionalInfo_, trackerHits::c, category_, context_, prof2calltree::count, i, and ost_.

Referenced by edm::ExceptionCollector::addException(), ConvertedPhotonProducer::buildCollections(), edm::ExceptionCollector::call(), StorageFactory::check(), evf::FUEventProcessor::configuring(), evf::FUEventProcessor::enableCommon(), evf::FUEventProcessor::enableForkInEDM(), DTVDriftWriter::endJob(), DTTTrigCorrection::endJob(), stor::StorageManager::handleFSMSoapMessage(), smproxy::SMProxyServer::handleFSMSoapMessage(), evf::FWEPWrapper::init(), edm::RootInputFileSequence::initFile(), main(), cms::operator<<(), edm::printCmsException(), edm::printCmsExceptionWarning(), CachedTrajectory::propagate(), ConversionVertexFinder::run(), StorageFactory::stagein(), evf::FWEPWrapper::stop(), TrajectoryStateClosestToPoint::TrajectoryStateClosestToPoint(), MuonUpdatorAtVertex::update(), and what().

                                         {
    std::ostringstream ost;

    if (context_.empty()) {
      ost << "An exception of category '" << category_ << "' occurred.\n";
    }
    else {
      ost << "An exception of category '" << category_ << "' occurred while\n";
      int count = 0;
      for (std::list<std::string>::const_reverse_iterator i = context_.rbegin(),
             iEnd = context_.rend();
           i != iEnd; ++i, ++count) {
        ost << "   [" << count << "] " << *i << "\n";
      }
    }

    std::string centralMessage(ost_.str());
    if (!centralMessage.empty()) {
      ost << "Exception Message:\n";
      ost << centralMessage;
      if (centralMessage[centralMessage.size() - 1] != '\n') {
        ost << "\n";
      }
    }

    if (!additionalInfo_.empty()) {
      ost << "   Additional Info:\n";
      char c = 'a';
      for (std::list<std::string>::const_reverse_iterator i = additionalInfo_.rbegin(),
             iEnd = additionalInfo_.rend();
           i != iEnd; ++i, ++c) {
        ost << "      [" << c << "] " << *i << "\n";
      }
    }
    return ost.str();
  }
std::list< std::string > Exception::history ( ) const

Definition at line 271 of file Exception.cc.

References category_.

                                              {
    std::list<std::string> returnValue;
    returnValue.push_back(category_);
    return returnValue;
  }
void Exception::init ( std::string const &  message) [private]

Definition at line 82 of file Exception.cc.

References message(), and ost_.

Referenced by Exception().

                                               {
    ost_ << message;
    if(!message.empty()) {
        unsigned sz = message.size()-1;
        if(message[sz] != '\n' && message[sz] != ' ') ost_ << " ";
    }
  }
std::string Exception::message ( ) const
Exception & Exception::operator= ( Exception const &  other)

Definition at line 135 of file Exception.cc.

References swap(), and groupFilesInBlocks::temp.

                                             {
    Exception temp(other);
    this->swap(temp);
    return *this;
  }
void cms::Exception::raise ( ) [inline]
void Exception::rethrow ( void  ) [private, virtual]

Reimplemented in edm::Exception, Fastexception, BaseGenexception, and Genexception.

Definition at line 263 of file Exception.cc.

Referenced by raise().

                          {
    throw *this;
  }
int Exception::returnCode ( ) const

Definition at line 199 of file Exception.cc.

References returnCode_().

Referenced by edm::addContextAndPrintException().

                                   {
    return returnCode_();
  }
int Exception::returnCode_ ( ) const [private, virtual]

Reimplemented in edm::Exception.

Definition at line 267 of file Exception.cc.

Referenced by returnCode().

                                    {
    return 8001;
  }
void Exception::setAdditionalInfo ( std::list< std::string > const &  info)

Definition at line 247 of file Exception.cc.

References additionalInfo_, and info.

void Exception::setAlreadyPrinted ( bool  value)

Definition at line 255 of file Exception.cc.

References alreadyPrinted_, and relativeConstraints::value.

Referenced by edm::addContextAndPrintException().

void Exception::setContext ( std::list< std::string > const &  context)

Definition at line 243 of file Exception.cc.

References context(), and context_.

                                                              {
    context_ = context;
  }
void Exception::swap ( Exception other)

Definition at line 125 of file Exception.cc.

References additionalInfo_, alreadyPrinted_, category_, context_, ost_, and what_.

Referenced by operator=().

                                  {
    ost_ << other.ost_.str();
    category_.swap(other.category_);
    what_.swap(other.what_);
    context_.swap(other.context_);
    additionalInfo_.swap(other.additionalInfo_);
    std::swap(alreadyPrinted_, other.alreadyPrinted_);
  }
char const * Exception::what ( ) const throw () [virtual]

Reimplemented in CMSexception, Fastexception, and BaseGenexception.

Definition at line 141 of file Exception.cc.

References explainSelf(), and what_.

Referenced by AdaptiveVertexReconstructor::AdaptiveVertexReconstructor(), MeasurementTrackerImpl::addStripDet(), sistrip::SpyIdentifyRunsModule::analyze(), MultiTrackValidator::analyze(), SiPixelLorentzAngleDB::analyze(), MuonTrackValidator::analyze(), AlcaBeamMonitor::analyze(), SiStripDetVOffFakeBuilder::analyze(), L1CondDBPayloadWriter::analyze(), PrimaryVertexValidation::analyze(), SiStripSpyMonitorModule::analyze(), evf::FUEventProcessor::attachDqmToShm(), HLTTauDQMAutomation::AutoCompleteConfig(), HLTTauDQMAutomation::AutoCompleteMatching(), AlcaBeamMonitor::beginLuminosityBlock(), GeometricSearchTrackerBuilder::build(), MagGeoBuilderFromDDD::buildInterpolator(), CSCSectorReceiverLUT::calcGlobalPhiME(), edm::service::MessageServicePSetValidation::check(), FWBeamSpot::checkBeamSpot(), PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >::Factory::create(), sistrip::RawToDigiUnpacker::createDigis(), sistrip::SpyUnpacker::createDigis(), evf::FUEventProcessor::detachDqmFromShm(), TestFunct::DropItem(), UncatchedException::dump(), FWModelChangeManager::endChanges(), exceptionTranslation(), cond::ExportIOVUtilities::execute(), sistrip::RawToClustersLazyUnpacker::fill(), SiStripMonitorPedestals::fillCondDBMEs(), NuclearVertexBuilder::FillVertexWithAdaptVtxFitter(), LaserAlignmentEventFilter::filter(), HLTTauDQMPlotter::FilterObject::FilterObject(), TrackerOfflineValidation::fitResiduals(), TrackerOfflineValidationSummary::fitResiduals(), CSCSectorReceiverLUT::getGlobalEtaValue(), CSCSectorReceiverLUT::getGlobalPhiValue(), HcalO2OManager::getListOfPoolIovs(), HcalO2OManager::getListOfPoolTags(), TestFunct::GetMetadata(), SiStripConfigDb::handleException(), edm::MessageLoggerQ::handshakedCommand(), HLTTauDQMCaloPlotter::HLTTauDQMCaloPlotter(), HLTTauDQML1Plotter::HLTTauDQML1Plotter(), HLTTauDQMLitePathPlotter::HLTTauDQMLitePathPlotter(), HLTTauDQMPathPlotter::HLTTauDQMPathPlotter(), HLTTauDQMSummaryPlotter::HLTTauDQMSummaryPlotter(), HLTTauDQMTrkPlotter::HLTTauDQMTrkPlotter(), evf::iDie::initFramework(), stor::EventConsumerSelector::initialize(), stor::EventStreamSelector::initialize(), PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::inspect(), SiPixelGainCalibrationService::isDead(), SiPixelGainCalibrationOfflineService::isDead(), SiPixelGainCalibrationForHLTSimService::isDead(), SiPixelGainCalibrationOfflineSimService::isDead(), SiPixelGainCalibrationForHLTService::isDead(), SiPixelGainCalibrationOfflineService::isDeadColumn(), SiPixelGainCalibrationOfflineSimService::isDeadColumn(), SiPixelGainCalibrationForHLTSimService::isDeadColumn(), SiPixelGainCalibrationForHLTService::isDeadColumn(), SiPixelGainCalibrationOfflineService::isNoisy(), SiPixelGainCalibrationForHLTService::isNoisy(), SiPixelGainCalibrationForHLTSimService::isNoisy(), SiPixelGainCalibrationOfflineSimService::isNoisy(), SiPixelGainCalibrationService::isNoisy(), SiPixelGainCalibrationForHLTSimService::isNoisyColumn(), SiPixelGainCalibrationForHLTService::isNoisyColumn(), SiPixelGainCalibrationOfflineSimService::isNoisyColumn(), SiPixelGainCalibrationOfflineService::isNoisyColumn(), main(), cond::BasePayloadProxy::make(), evf::FUEventProcessor::microState(), tfwliteselectortest::ThingsTSelector::process(), tfwliteselectortest::ThingsWorker::process(), cond::XMLAuthenticationService::XMLAuthenticationService::processFile(), HLTTauDQMOfflineSource::processPSet(), SoftElectronProducer::produce(), HcalRawToDigi::produce(), EcalDCCTB07UnpackingModule::produce(), sistrip::FEDEmulatorModule::produce(), CSCTFUnpacker::produce(), EcalDCCTBUnpackingModule::produce(), HcalDigiToRaw::produce(), sistrip::SpyEventSummaryProducer::produce(), CastorDigiToRaw::produce(), CastorRawToDigi::produce(), PhotonConversionTrajectorySeedProducerFromQuadruplets::produce(), TestFunct::Read(), TestFunct::ReadAll(), TestFunct::ReadWithIOV(), RecoProducerFP420::RecoProducerFP420(), sistrip::FEDEmulator::retrieveNoises(), sistrip::FEDEmulator::retrievePedestals(), cond::Utilities::run(), KalmanAlignmentAlgorithm::run(), edm::service::MessageLoggerScribe::runCommand(), FWPathsPopup::scheduleReloadEvent(), evf::FUEventProcessor::setAttachDqmToShm(), edm::convertException::stdToEDM(), evf::FUEventProcessor::stopClassic(), SiStripPedestalsSubtractor::subtract_(), TestFunct::Write(), DTCalibDBUtils::writeToDB(), and TestFunct::WriteWithIOV().

                                            {
    what_ = explainSelf();
    return what_.c_str();
  }

Friends And Related Function Documentation

template<typename E , typename T >
detail::Desired<E, detail::is_derived_or_same<Exception,E>::value>::type& operator<< ( E &  e,
T const &  stuff 
) [friend]

Definition at line 227 of file Exception.h.

  {
    e.ost_ << stuff;
    return e;
  }
template<typename E >
detail::Desired<E, detail::is_derived_or_same<Exception,E>::value>::type const& operator<< ( E const &  e,
std::ios_base &(*)(std::ios_base &)  f 
) [friend]

Definition at line 275 of file Exception.h.

  {
    E& ref = const_cast<E&>(e);
    f(ref.ost_);
    return e;
  }
template<typename E >
detail::Desired<E, detail::is_derived_or_same<Exception,E>::value>::type& operator<< ( E &  e,
std::ios_base &(*)(std::ios_base &)  f 
) [friend]

Definition at line 265 of file Exception.h.

  {
    f(e.ost_);
    return e;
  }
template<typename E >
detail::Desired<E, detail::is_derived_or_same<Exception,E>::value>::type const& operator<< ( E const &  e,
std::ostream &(*)(std::ostream &)  f 
) [friend]

Definition at line 255 of file Exception.h.

  {
    E& ref = const_cast<E&>(e);
    f(ref.ost_);
    return e;
  }
template<typename E >
detail::Desired<E, detail::is_derived_or_same<Exception,E>::value>::type& operator<< ( E &  e,
std::ostream &(*)(std::ostream &)  f 
) [friend]

Definition at line 246 of file Exception.h.

  {
    f(e.ost_);
    return e;
  }
template<typename E , typename T >
detail::Desired<E, detail::is_derived_or_same<Exception,E>::value>::type const& operator<< ( E const &  e,
T const &  stuff 
) [friend]

Definition at line 236 of file Exception.h.

  {
    E& ref = const_cast<E&>(e);
    ref.ost_ << stuff;
    return e;
  }

Member Data Documentation

std::list<std::string> cms::Exception::additionalInfo_ [private]

Definition at line 211 of file Exception.h.

Referenced by alreadyPrinted(), setAlreadyPrinted(), and swap().

std::string cms::Exception::category_ [private]

Reimplemented in edm::Exception.

Definition at line 207 of file Exception.h.

Referenced by category(), explainSelf(), history(), and swap().

std::list<std::string> cms::Exception::context_ [private]

Definition at line 209 of file Exception.h.

Referenced by addContext(), clearContext(), context(), explainSelf(), setContext(), and swap().

std::ostringstream cms::Exception::ost_ [private]

Definition at line 206 of file Exception.h.

Referenced by append(), clearMessage(), Exception(), explainSelf(), init(), message(), and swap().

std::string cms::Exception::what_ [mutable, private]

Definition at line 208 of file Exception.h.

Referenced by swap(), and what().