Exception.hpp 851 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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-31
  7. *
  8. * */
  9. #ifndef LS_STD_EXCEPTION_HPP
  10. #define LS_STD_EXCEPTION_HPP
  11. #include <exception>
  12. #include <ls-std/core/definition.hpp>
  13. #include <string>
  14. #include <string_view>
  15. namespace ls::std::core
  16. {
  17. ls_std_class Exception : public ::std::exception
  18. {
  19. public:
  20. explicit Exception(::std::string _name);
  21. ~Exception() noexcept override = 0;
  22. [[nodiscard]] ::std::string getName() const;
  23. protected:
  24. [[nodiscard]] const char *_getIdentifiedMessage(const ::std::string &_defaultMessage) const;
  25. void _setMessage(::std::string_view _message);
  26. private:
  27. ::std::string message{};
  28. ::std::string name{};
  29. };
  30. }
  31. #endif