CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/FWCore/MessageLogger/src/ExceptionMessages.cc

Go to the documentation of this file.
00001 #include "FWCore/MessageLogger/interface/ExceptionMessages.h"
00002 #include "FWCore/Utilities/interface/Exception.h"
00003 #include "FWCore/MessageLogger/interface/JobReport.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 #include "FWCore/Utilities/interface/TimeOfDay.h"
00006 
00007 #include <string>
00008 #include <sstream>
00009 #include <iomanip>
00010 
00011 namespace edm {
00012   void 
00013   printCmsException(cms::Exception& e, edm::JobReport * jobRep, int rc) try {
00014     std::string shortDesc("Fatal Exception");
00015     std::ostringstream longDesc;
00016     longDesc << e.explainSelf();
00017     LogAbsolute(shortDesc)
00018       << "----- Begin " << shortDesc << " "
00019       << std::setprecision(0) << TimeOfDay()
00020       << "-----------------------\n"
00021       << longDesc.str()
00022       << "----- End " << shortDesc << " -------------------------------------------------";
00023     if(jobRep) jobRep->reportError(shortDesc, longDesc.str(), rc);
00024   } catch(...) {
00025   }
00026 
00027   void
00028   printCmsExceptionWarning(char const* behavior, cms::Exception const& e, edm::JobReport * jobRep, int rc) try {
00029     std::string shortDesc(behavior);
00030     shortDesc += " Exception";
00031     std::ostringstream longDesc;
00032     longDesc << e.explainSelf();
00033     LogPrint(shortDesc)
00034       << "----- Begin " << shortDesc << " "
00035       << std::setprecision(0) << TimeOfDay()
00036       << "-----------------------\n"
00037       << longDesc.str()
00038       << "----- End " << shortDesc << " -------------------------------------------------";
00039     if(jobRep) jobRep->reportError(shortDesc, longDesc.str(), rc);
00040   } catch(...) {
00041   }
00042 }