starting work on websocket chat reader

This commit is contained in:
Ikatono
2024-05-27 13:53:31 -05:00
parent 230f382015
commit 5451a1151c
13 changed files with 620 additions and 6 deletions

40
ircexception.cpp Normal file
View File

@@ -0,0 +1,40 @@
#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)
{
}