CMS 3D CMS Logo

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