41 lines
989 B
C++
41 lines
989 B
C++
#include "ircexception.hpp"
|
|
|
|
IrcException::IrcException(QString _what)
|
|
: _what(_what.toLocal8Bit())
|
|
{
|
|
|
|
}
|
|
|
|
const char* IrcException::what() const noexcept
|
|
{
|
|
return _what.data();
|
|
}
|
|
|
|
IrcTagNotFoundException::IrcTagNotFoundException(QString tag)
|
|
: IrcException(QString("missing tag: %1").arg(tag)), tag(tag)
|
|
{
|
|
|
|
}
|
|
|
|
IrcParseException::IrcParseException(QString message, QString description)
|
|
: IrcException(_makeWhat(message, description)),
|
|
message(message), description(description)
|
|
{
|
|
|
|
}
|
|
|
|
QString IrcParseException::_makeWhat(QString message, QString description)
|
|
{
|
|
QString s = "";
|
|
if (!message.isEmpty())
|
|
s = QString("Description: %1\n").arg(description);
|
|
return s + QString("Message: %1").arg(message);
|
|
}
|
|
|
|
IrcIncorrectTypeException::IrcIncorrectTypeException(IrcMessageType expected, IrcMessageType actual)
|
|
: IrcException(QString("Expected: %1 Actual: %2").arg(expected.toString(), actual.toString())),
|
|
expected(expected), actual(actual)
|
|
{
|
|
|
|
}
|