CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/FWCore/Framework/src/ExceptionHelpers.cc

Go to the documentation of this file.
00001 #include "FWCore/Framework/interface/ExceptionHelpers.h"
00002 
00003 #include "FWCore/MessageLogger/interface/ExceptionMessages.h"
00004 #include "FWCore/MessageLogger/interface/JobReport.h"
00005 #include "FWCore/ServiceRegistry/interface/Service.h"
00006 
00007 #include <cstring>
00008 
00009 namespace edm {
00010 
00011   void
00012   addContextAndPrintException(char const* context,
00013                               cms::Exception& ex,
00014                               bool disablePrint) {
00015     if (context != 0 && strlen(context) != 0U) {
00016       ex.addContext(context);
00017     }
00018     if (!disablePrint) {
00019       Service<JobReport> jobReportSvc;
00020       if (jobReportSvc.isAvailable()) {
00021         JobReport *jobRep = jobReportSvc.operator->();
00022         edm::printCmsException(ex, jobRep, ex.returnCode());
00023       }
00024       else {
00025         edm::printCmsException(ex);
00026       }
00027       ex.setAlreadyPrinted(true);
00028     }
00029   }
00030 }