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
12  addContextAndPrintException(char const* context,
13  cms::Exception& ex,
14  bool disablePrint) {
15  if (context != nullptr && strlen(context) != 0U) {
16  ex.addContext(context);
17  }
18  if (!disablePrint) {
19  Service<JobReport> jobReportSvc;
20  if (jobReportSvc.isAvailable()) {
21  JobReport *jobRep = jobReportSvc.operator->();
22  edm::printCmsException(ex, jobRep, ex.returnCode());
23  }
24  else {
26  }
27  ex.setAlreadyPrinted(true);
28  }
29  }
30 }
void setAlreadyPrinted(bool value)
Definition: Exception.cc:255
void printCmsException(cms::Exception &e, edm::JobReport *jobRep=nullptr, int rc=-1)
void addContextAndPrintException(char const *context, cms::Exception &ex, bool disablePrint)
bool isAvailable() const
Definition: Service.h:46
void addContext(std::string const &context)
Definition: Exception.cc:227
int returnCode() const
Definition: Exception.cc:199
HLT enums.