CMS 3D CMS Logo

ConvertException.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_ConvertException_h
2 #define FWCore_Utilities_ConvertException_h
3 
4 #include <string>
5 #include <exception>
6 #include <functional>
8 
9 namespace edm {
10  namespace convertException {
11  void badAllocToEDM();
12  void stdToEDM(std::exception const& e);
13  void stringToEDM(std::string& s);
14  void charPtrToEDM(char const* c);
15  void unknownToEDM();
16 
17  template <typename F>
18  auto wrap(F iFunc) -> decltype(iFunc()) {
19  try {
20  return iFunc();
21  } catch (cms::Exception&) {
22  throw;
23  } catch (std::bad_alloc&) {
25  } catch (std::exception& e) {
27  } catch (std::string& s) {
29  } catch (char const* c) {
31  } catch (...) {
33  }
34  //Never gets here
35  typedef decltype(iFunc()) ReturnType;
36  return ReturnType();
37  }
38  } // namespace convertException
39 } // namespace edm
40 
41 #endif
std::map< DetId, double > ReturnType
void stdToEDM(std::exception const &e)
void charPtrToEDM(char const *c)
void stringToEDM(std::string &s)
HLT enums.
auto wrap(F iFunc) -> decltype(iFunc())
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163