Eazy Datetime Cpp
datetime_exceptions.h
1 #ifndef _MY_DATETIME_EXCEPTIONS_
2 #define _MY_DATETIME_EXCEPTIONS_
3 
4 #include <stdexcept>
5 #include <string>
6 namespace EZ
7 {
8  class DatetimeException : std::exception
9  {
10  const char *m_msg;
11 
12  public:
13  DatetimeException(const char *msg) : m_err(msg)
14  {
15  }
16  DatetimeException(const std::string str) : m_err(str.c_str())
17  {
18  }
19 
20  const char *what() const throw()
21  {
22  return m_err.what();
23  }
24 
25  private:
26  // use runtime_error to store error messages
27  std::runtime_error m_err;
28  };
29 }
30 #endif
Definition: datetime_exceptions.h:9