EventNotHandledException.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-04
  6. * Changed: 2023-02-22
  7. *
  8. * */
  9. #include <ls-std/core/exception/EventNotHandledException.hpp>
  10. #include <ls-std/core/exception/ExceptionMessage.hpp>
  11. ls::std::core::EventNotHandledException::EventNotHandledException() : ls::std::core::Exception("EventNotHandledException")
  12. {}
  13. ls::std::core::EventNotHandledException::EventNotHandledException(::std::string _message) : ls::std::core::EventNotHandledException()
  14. {
  15. this->message = ::std::move(_message);
  16. }
  17. ls::std::core::EventNotHandledException::~EventNotHandledException() = default;
  18. const char *ls::std::core::EventNotHandledException::what() const noexcept
  19. {
  20. ::std::string concatenatedMessage = this->name + " thrown - ";
  21. if (this->message.empty())
  22. {
  23. concatenatedMessage = concatenatedMessage + "event was not handled - nothing happened!";
  24. }
  25. else
  26. {
  27. concatenatedMessage = concatenatedMessage + this->message;
  28. }
  29. return ExceptionMessage{concatenatedMessage}.toCharacterPointer();
  30. }