1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2023-02-22
- * Changed: 2023-05-19
- *
- * */
- #include <ls-std/core/exception/Exception.hpp>
- #include <ls-std/core/exception/ExceptionMessage.hpp>
- using ls::std::core::Exception;
- using std::move;
- using std::string;
- using std::string_view;
- Exception::Exception(string _name) : name(::move(_name))
- {}
- Exception::~Exception() noexcept = default;
- string Exception::getName() const
- {
- return this->name;
- }
- const char *Exception::_getIdentifiedMessage(const string &_defaultMessage) const
- {
- string concatenatedMessage = this->name + " thrown - ";
- if (this->message.empty())
- {
- concatenatedMessage = concatenatedMessage + _defaultMessage;
- }
- else
- {
- concatenatedMessage = concatenatedMessage + this->message;
- }
- return ExceptionMessage{concatenatedMessage}.toCharacterPointer();
- }
- void Exception::_setMessage(string_view _message)
- {
- this->message = _message;
- }
|