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