LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ExceptionMessages.cc
Go to the documentation of this file.
2 #include "cetlib/trim.h"
3 #include "cetlib_except/exception.h"
5 
6 #include <sstream>
7 #include <string>
8 
9 using mf::LogSystem;
10 
11 namespace art {
12  void
13  printArtException(cet::exception const& e, char const* prog)
14  try {
15  std::string programName(prog ? prog : "program");
16  std::string shortDesc("ArtException");
17  std::ostringstream longDesc;
18  longDesc << "cet::exception caught in " << programName << '\n'
19  << cet::trim_right_copy(e.explain_self(), " \n");
20  LogSystem(shortDesc) << longDesc.str();
21  }
22  catch (...) {
23  }
24 
25  void
26  printBadAllocException(char const* prog)
27  try {
28  std::string programName(prog ? prog : "program");
29  std::string shortDesc("std::bad_allocException");
30  std::ostringstream longDesc;
31  longDesc
32  << "std::bad_alloc exception caught in " << programName << '\n'
33  << "The job has probably exhausted the virtual memory available to "
34  "the process.";
35  LogSystem(shortDesc) << longDesc.str();
36  }
37  catch (...) {
38  }
39 
40  void
41  printStdException(std::exception const& e, char const* prog)
42  try {
43  std::string programName(prog ? prog : "program");
44  std::string shortDesc("StdLibException");
45  std::ostringstream longDesc;
46  longDesc << "Standard library exception caught in " << programName << '\n'
47  << cet::trim_right_copy(e.what(), " \n");
48  LogSystem(shortDesc) << longDesc.str();
49  }
50  catch (...) {
51  }
52 
53  void
54  printUnknownException(char const* prog)
55  try {
56  std::string programName(prog ? prog : "program");
57  std::string shortDesc("UnknownException");
58  std::ostringstream longDesc;
59  longDesc << "Unknown exception caught in " << programName;
60  LogSystem(shortDesc) << longDesc.str();
61  }
62  catch (...) {
63  }
64 
65 } // namespace art
void printStdException(std::exception const &e, char const *prog)
void printUnknownException(char const *prog)
MaybeLogger_< ELseverityLevel::ELsev_severe, false > LogSystem
void printArtException(cet::exception const &e, char const *prog)
Definition: MVAAlg.h:12
void printBadAllocException(char const *prog)
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33