CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EDMException.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_EDMException_h
2 #define FWCore_Utilities_EDMException_h
3 
22 #include <map>
23 #include <string>
24 
25 #define EDM_MAP_ENTRY(map, ns, name) map[ns::name]=#name
26 #define EDM_MAP_ENTRY_NONS(map, name) map[name]=#name
27 
28 namespace edm {
29  namespace errors {
30 
31  // If you add a new entry to the set of values, make sure to
32  // update the translation map in EDMException.cc, the actions
33  // table in FWCore/Framework/src/Actions.cc, and the configuration
34  // fragment FWCore/Framework/test/cmsExceptionsFatalOption.cff.
35 
36  enum ErrorCodes {
37  OtherCMS = 8001,
38  StdException = 8002,
39  Unknown = 8003,
40  BadAlloc = 8004,
42 
45  InsertFailure = 8008,
46  Configuration = 8009,
47  LogicError = 8010,
52  EventTimeout = 8015,
54 
57 
59  FileOpenError = 8020,
60  FileReadError = 8021,
63 
66 
67  NotFound = 8026
68  };
69 
70  }
71 
72  class Exception : public cms::Exception {
73  public:
75 
76  explicit Exception(Code category);
77 
78  Exception(Code category, std::string const& message);
79 
80  Exception(Code category, std::string const& message, cms::Exception const& another);
81 
82  Exception(Exception const& other);
83 
84  virtual ~Exception() throw();
85 
86  Code categoryCode() const { return category_; }
87 
88  int returnCode() const { return static_cast<int>(category_); }
89 
90  static std::string codeToString(Code);
91 
92  typedef std::map<Code, std::string> CodeMap;
93 
94  static void throwThis(Code category,
95  char const* message0 = "",
96  char const* message1 = "",
97  char const* message2 = "",
98  char const* message3 = "",
99  char const* message4 = "");
100  static void throwThis(Code category, char const* message0, int intVal, char const* message2 = "");
101  private:
102 
103  virtual void rethrow();
104 
106  };
107 
108 }
109 
110 #endif
Code categoryCode() const
Definition: EDMException.h:86
errors::ErrorCodes Code
Definition: EDMException.h:74
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:81
static std::string codeToString(Code)
-----------— implementation details ---------------—
Definition: EDMException.cc:48
Exception(Code category)
Definition: EDMException.cc:57
int returnCode() const
Definition: EDMException.h:88
string message
Definition: argparse.py:126
std::map< Code, std::string > CodeMap
Definition: EDMException.h:92
virtual void rethrow()
virtual ~Exception()
Definition: EDMException.cc:77
std::string category() const
Definition: Exception.cc:74