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