ATLAS Offline Software
CheckExc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #ifndef CHECKEXC_H
7 #define CHECKEXC_H
8 
9 #include <ostream>
10 #include <stdexcept>
11 
16 #define CHECK_EXC(ARG) \
17  do { \
18  const bool result = static_cast<bool>(ARG); \
19  if (!result) { \
20  std::ostringstream os; \
21  os << "Failed to execute: \"" << #ARG << "\""; \
22  throw std::runtime_error(os.str()); \
23  } \
24  } while (false)
25 
26 #endif//CHECKEXC_H