1 #ifndef EUDAQ_INCLUDED_Exception
2 #define EUDAQ_INCLUDED_Exception
13 #define EUDAQ_THROWX(exc, msg) \
14 throw ::eudaq::InitException(exc(msg), __FILE__, __LINE__, EUDAQ_FUNC)
15 #define EUDAQ_THROW(msg) EUDAQ_THROWX(::eudaq::LoggedException, (msg))
16 #define EUDAQ_THROW_NOLOG(msg) EUDAQ_THROWX(::eudaq::Exception, (msg))
18 #define EUDAQ_EXCEPTIONX(name, base) \
19 class name : public base { \
21 name(const std::string &msg) : base(msg) {} \
24 #define EUDAQ_EXCEPTION(name) EUDAQ_EXCEPTIONX(name, ::eudaq::Exception)
29 #pragma warning(disable: 4275)
38 const char *what()
const throw() {
39 if (m_text.length() == 0)
41 return m_text.c_str();
45 const Exception &SetLocation(
const std::string &file =
"",
47 const std::string &func =
"")
const;
54 void make_text()
const;
55 mutable std::string m_text;
56 mutable std::string m_file, m_func;
57 mutable unsigned m_line;
67 mutable bool m_logged;
72 void do_log(
const LoggedException &e) { e.Log(); }
76 const T &InitException(
const T &e,
const std::string &file,
int line = 0,
77 const std::string func =
"") {
78 e.SetLocation(file, line, func);
84 EUDAQ_EXCEPTION(FileNotFoundException);
85 EUDAQ_EXCEPTION(FileExistsException);
86 EUDAQ_EXCEPTION(FileNotWritableException);
87 EUDAQ_EXCEPTION(FileReadException);
88 EUDAQ_EXCEPTION(FileWriteException);
89 EUDAQ_EXCEPTION(FileFormatException);
90 EUDAQ_EXCEPTION(SyncException);
91 EUDAQ_EXCEPTION(CommunicationException);
92 EUDAQ_EXCEPTIONX(BusError, CommunicationException);
101 #endif // EUDAQ_INCLUDED_Exception
Definition: Exception.hh:35
Definition: Exception.hh:60