IncompleteJsonException.cpp 1.0 KB

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