Exception.hpp 1.0 KB

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