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),
50  static const std::string kUnknownCode("unknownCode");
51  } // namespace errors
53 
55  auto i(errors::codeMap.find(c));
56  return i != errors::codeMap.end() ? i->second : errors::kUnknownCode;
57  }
58 
59  Exception::Exception(errors::ErrorCodes aCategory) : cms::Exception(codeToString(aCategory)), category_(aCategory) {}
60 
62  : cms::Exception(codeToString(aCategory), message), category_(aCategory) {}
63 
64  Exception::Exception(errors::ErrorCodes aCategory, char const* message)
65  : cms::Exception(codeToString(aCategory), std::string(message)), category_(aCategory) {}
66 
67  Exception::Exception(errors::ErrorCodes aCategory, std::string const& message, cms::Exception const& another)
68  : cms::Exception(codeToString(aCategory), message, another), category_(aCategory) {}
69 
70  Exception::Exception(errors::ErrorCodes aCategory, char const* message, cms::Exception const& another)
71  : cms::Exception(codeToString(aCategory), std::string(message), another), category_(aCategory) {}
72 
73  Exception::Exception(Exception const& other) : cms::Exception(other), category_(other.category_) {}
74 
75  Exception::~Exception() noexcept {}
76 
79  this->swap(temp);
80  return *this;
81  }
82 
83  int Exception::returnCode_() const { return static_cast<int>(category_); }
84 
86  char const* message0,
87  char const* message1,
88  char const* message2,
89  char const* message3,
90  char const* message4) {
91  Exception e(aCategory, std::string(message0));
92  e << message1 << message2 << message3 << message4;
93  throw e;
94  }
95 
96  void Exception::throwThis(errors::ErrorCodes aCategory, char const* message0, int intVal, char const* message1) {
97  Exception e(aCategory, std::string(message0));
98  e << intVal << message1;
99  throw e;
100  }
101 
102  Exception* Exception::clone() const { return new Exception(*this); }
103 
104  void Exception::rethrow() { throw *this; }
105 } // namespace edm
int returnCode_() const override
Definition: EDMException.cc:83
static const std::string & codeToString(Code)
-----------— implementation details ---------------—
Definition: EDMException.cc:54
void rethrow() override
#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:19
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:85
void swap(Exception &other)
Definition: EDMException.h:96
static const std::map< ErrorCodes, std::string > codeMap
Definition: EDMException.cc:9
Namespace of DDCMS conversion namespace.
Exception(Code category)
Definition: EDMException.cc:59
HLT enums.
~Exception() noexcept override
Definition: EDMException.cc:75
Definition: errors.py:1
Exception & operator=(Exception const &other)
Definition: EDMException.cc:77
Exception * clone() const override