CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/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 #include "FWCore/Utilities/interface/Exception.h"
00007 
00008 #include <cstring>
00009 
00010 namespace edm {
00011 
00012   void
00013   addContextAndPrintException(char const* context,
00014                               cms::Exception& ex,
00015                               bool disablePrint) {
00016     if (context != 0 && strlen(context) != 0U) {
00017       ex.addContext(context);
00018     }
00019     if (!disablePrint) {
00020       Service<JobReport> jobReportSvc;
00021       if (jobReportSvc.isAvailable()) {
00022         JobReport *jobRep = jobReportSvc.operator->();
00023         edm::printCmsException(ex, jobRep, ex.returnCode());
00024       }
00025       else {
00026         edm::printCmsException(ex);
00027       }
00028       ex.setAlreadyPrinted(true);
00029     }
00030   }
00031 }