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>
9 
10 namespace edm {
11  namespace convertException {
12  void badAllocToEDM();
13  void stdToEDM(std::exception const& e);
14  void stringToEDM(std::string& s);
15  void charPtrToEDM(char const* c);
16  void unknownToEDM();
17 
18  template <typename F>
19  auto wrap(F iFunc) -> decltype(iFunc()) {
20  // Caught exception is rethrown
21  CMS_SA_ALLOW try { return iFunc(); } 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
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::convertException::charPtrToEDM
void charPtrToEDM(char const *c)
Definition: ConvertException.cc:28
edm::convertException::unknownToEDM
void unknownToEDM()
Definition: ConvertException.cc:34
CMS_SA_ALLOW
#define CMS_SA_ALLOW
Definition: thread_safety_macros.h:5
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::convertException::wrap
auto wrap(F iFunc) -> decltype(iFunc())
Definition: ConvertException.h:19
ecaldqm::ReturnType
std::map< DetId, double > ReturnType
Definition: DBReaderWorkers.cc:54
edm::convertException::stringToEDM
void stringToEDM(std::string &s)
Definition: ConvertException.cc:22
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::convertException::stdToEDM
void stdToEDM(std::exception const &e)
Definition: ConvertException.cc:16
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
thread_safety_macros.h
edm::convertException::badAllocToEDM
void badAllocToEDM()
Definition: ConvertException.cc:8
Exception.h
cms::Exception
Definition: Exception.h:70
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37