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