Exception.hpp 920 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-22
  6. * Changed: 2024-05-25
  7. *
  8. * */
  9. #ifndef LS_STD_EXCEPTION_HPP
  10. #define LS_STD_EXCEPTION_HPP
  11. #include <exception>
  12. #include <ls-std/os/dynamic-goal.hpp>
  13. #include <string>
  14. #include <string_view>
  15. /*
  16. * @class(name: 'Exception', package: 'core')
  17. * */
  18. namespace ls::std::core
  19. {
  20. class LS_STD_DYNAMIC_GOAL Exception : public ::std::exception
  21. {
  22. public:
  23. explicit Exception(::std::string _name);
  24. ~Exception() noexcept override = 0;
  25. [[nodiscard]] ::std::string getName() const;
  26. protected:
  27. [[nodiscard]] const char *_getIdentifiedMessage(const ::std::string &_defaultMessage) const;
  28. void _setMessage(::std::string_view _message);
  29. private:
  30. ::std::string message{};
  31. ::std::string name{};
  32. };
  33. }
  34. #endif