NotImplementedException.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-03-27
  6. * Changed: 2023-03-27
  7. *
  8. * */
  9. #include <ls-std/core/exception/ExceptionMessage.hpp>
  10. #include <ls-std/core/exception/NotImplementedException.hpp>
  11. #include <string>
  12. using ls::std::core::Exception;
  13. using ls::std::core::ExceptionMessage;
  14. using ls::std::core::NotImplementedException;
  15. using std::move;
  16. using std::string;
  17. NotImplementedException::NotImplementedException() : Exception("NotImplementedException")
  18. {}
  19. NotImplementedException::NotImplementedException(string _message) : NotImplementedException()
  20. {
  21. this->message = ::move(_message);
  22. }
  23. NotImplementedException::~NotImplementedException() noexcept = default;
  24. const char *NotImplementedException::what() const noexcept
  25. {
  26. string concatenatedMessage = this->name + " thrown - ";
  27. if (this->message.empty())
  28. {
  29. concatenatedMessage = concatenatedMessage + "method is not implemented and should not be used!";
  30. }
  31. else
  32. {
  33. concatenatedMessage = concatenatedMessage + this->message;
  34. }
  35. return ExceptionMessage{concatenatedMessage}.toCharacterPointer();
  36. }