CMS 3D CMS Logo

EDMException.cc
Go to the documentation of this file.
1 
3 
4 #define FILLENTRY(name) \
5  { name, #name }
6 
7 namespace edm {
8  namespace errors {
9  static const std::map<ErrorCodes, std::string> codeMap = {FILLENTRY(CommandLineProcessing),
47  static const std::string kUnknownCode("unknownCode");
48  } // namespace errors
50 
52  auto i(errors::codeMap.find(c));
53  return i != errors::codeMap.end() ? i->second : errors::kUnknownCode;
54  }
55 
56  Exception::Exception(errors::ErrorCodes aCategory) : cms::Exception(codeToString(aCategory)), category_(aCategory) {}
57 
59  : cms::Exception(codeToString(aCategory), message), category_(aCategory) {}
60 
62  : cms::Exception(codeToString(aCategory), std::string(message)), category_(aCategory) {}
63 
65  : cms::Exception(codeToString(aCategory), message, another), category_(aCategory) {}
66 
67  Exception::Exception(errors::ErrorCodes aCategory, char const* message, cms::Exception const& another)
68  : cms::Exception(codeToString(aCategory), std::string(message), another), category_(aCategory) {}
69 
71 
73 
75  Exception temp(other);
76  this->swap(temp);
77  return *this;
78  }
79 
80  int Exception::returnCode_() const { return static_cast<int>(category_); }
81 
83  char const* message0,
84  char const* message1,
85  char const* message2,
86  char const* message3,
87  char const* message4) {
88  Exception e(aCategory, std::string(message0));
89  e << message1 << message2 << message3 << message4;
90  throw e;
91  }
92 
93  void Exception::throwThis(errors::ErrorCodes aCategory, char const* message0, int intVal, char const* message1) {
94  Exception e(aCategory, std::string(message0));
95  e << intVal << message1;
96  throw e;
97  }
98 
99  Exception* Exception::clone() const { return new Exception(*this); }
100 
101  void Exception::rethrow() { throw *this; }
102 } // namespace edm
static const std::string & codeToString(Code)
-----------— implementation details ---------------—
Definition: EDMException.cc:51
void rethrow() override
int returnCode_() const override
Definition: EDMException.cc:80
std::string message() const
Definition: Exception.cc:145
#define FILLENTRY(name)
Definition: EDMException.cc:4
static const std::string kUnknownCode("unknownCode")
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:82
void swap(Exception &other)
Definition: EDMException.h:92
Exception * clone() const override
Definition: EDMException.cc:99
static const std::map< ErrorCodes, std::string > codeMap
Definition: EDMException.cc:9
~Exception() override
Definition: EDMException.cc:72
Namespace of DDCMS conversion namespace.
#define noexcept
Exception(Code category)
Definition: EDMException.cc:56
HLT enums.
Definition: errors.py:1
Exception & operator=(Exception const &other)
Definition: EDMException.cc:74