IncompleteJsonException.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/ExceptionMessage.hpp>
  10. #include <ls-std/core/exception/IncompleteJsonException.hpp>
  11. ls::std::core::IncompleteJsonException::IncompleteJsonException() : ls::std::core::Exception("IncompleteJsonException")
  12. {}
  13. ls::std::core::IncompleteJsonException::IncompleteJsonException(::std::string _message) : ls::std::core::IncompleteJsonException()
  14. {
  15. this->message = ::std::move(_message);
  16. }
  17. ls::std::core::IncompleteJsonException::~IncompleteJsonException() = default;
  18. const char *ls::std::core::IncompleteJsonException::what() const noexcept
  19. {
  20. ::std::string concatenatedMessage = this->name + " thrown - ";
  21. if (this->message.empty())
  22. {
  23. concatenatedMessage = concatenatedMessage + "this JSON string is incomplete.";
  24. }
  25. else
  26. {
  27. concatenatedMessage = concatenatedMessage + this->message;
  28. }
  29. return ExceptionMessage{concatenatedMessage}.toCharacterPointer();
  30. }