exception.h 441 B

12345678910111213141516171819202122232425262728
  1. #pragma once
  2. #include <string>
  3. #include <exception>
  4. #include "base/define.h"
  5. /**
  6. * @brief 异常处理类
  7. */
  8. namespace ylib
  9. {
  10. class exception:public std::exception
  11. {
  12. public:
  13. exception(const std::string &msg);
  14. ~exception();
  15. virtual char const* what() const
  16. #ifdef __linux__
  17. noexcept
  18. #endif
  19. override{return m_msg.c_str();}
  20. private:
  21. std::string m_msg;
  22. };
  23. }