CMS 3D CMS Logo

ExceptionHelpers.cc
Go to the documentation of this file.
2 
6 
7 #include <cstring>
8 
9 namespace edm {
10 
11  void addContextAndPrintException(char const* context, cms::Exception& ex, bool disablePrint) {
12  if (context != nullptr && strlen(context) != 0U) {
13  ex.addContext(context);
14  }
15  if (!disablePrint) {
16  Service<JobReport> jobReportSvc;
17  if (jobReportSvc.isAvailable()) {
18  JobReport* jobRep = jobReportSvc.operator->();
19  edm::printCmsException(ex, jobRep, ex.returnCode());
20  } else {
22  }
23  ex.setAlreadyPrinted(true);
24  }
25  }
26 } // namespace edm
void setAlreadyPrinted(bool value)
Definition: Exception.cc:179
void printCmsException(cms::Exception &e, edm::JobReport *jobRep=nullptr, int rc=-1)
int returnCode() const
Definition: Exception.cc:151
void addContextAndPrintException(char const *context, cms::Exception &ex, bool disablePrint)
void addContext(std::string const &context)
Definition: Exception.cc:165
HLT enums.
bool isAvailable() const
Definition: Service.h:40