Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:11

0001 #include "FWCore/ServiceRegistry/interface/ESModuleCallingContext.h"
0002 #include "FWCore/ServiceRegistry/interface/ParentContext.h"
0003 #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h"
0004 #include "FWCore/Utilities/interface/EDMException.h"
0005 #include "FWCore/Framework/interface/ComponentDescription.h"
0006 
0007 #include <ostream>
0008 
0009 namespace edm {
0010 
0011   void exceptionContext(cms::Exception& ex, ESModuleCallingContext const& mcc) {
0012     ESModuleCallingContext const* imcc = &mcc;
0013     while (true) {
0014       std::ostringstream iost;
0015       if (imcc->state() == ESModuleCallingContext::State::kPrefetching) {
0016         iost << "Prefetching for EventSetup module ";
0017       } else {
0018         iost << "Calling method for EventSetup module ";
0019       }
0020       iost << imcc->componentDescription()->type_ << "/'" << imcc->componentDescription()->label_ << "'";
0021 
0022       ex.addContext(iost.str());
0023       if (imcc->type() != ESParentContext::Type::kESModule) {
0024         break;
0025       }
0026       imcc = imcc->esmoduleCallingContext();
0027     }
0028     if (imcc->type() == ESParentContext::Type::kModule) {
0029       edm::exceptionContext(ex, *imcc->moduleCallingContext());
0030     }
0031   }
0032 }  // namespace edm