1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 01:36:38 +02:00

Add ProtocolException and use it to send fatal errors.

This commit is contained in:
Sadie Powell
2024-03-12 00:00:36 +00:00
parent a15f165a1d
commit 1538909ac0
4 changed files with 39 additions and 31 deletions
+13 -1
View File
@@ -77,7 +77,19 @@ void Anope::Process(const Anope::string &buffer)
else if (m->HasFlag(IRCDMessage::FLAG_REQUIRE_SERVER) && !source.empty() && !src.GetServer())
Log(LOG_DEBUG) << "unexpected non-server source " << source << " for " << command;
else
m->Run(src, params, tags);
{
try
{
m->Run(src, params, tags);
}
catch (const ProtocolException &err)
{
IRCD->SendError(err.GetReason());
Anope::QuitReason = "Protocol error: " + err.GetReason();
Anope::Quitting = true;
Anope::ReturnValue = EXIT_FAILURE;
}
}
}
bool IRCDProto::Parse(const Anope::string &buffer, Anope::map<Anope::string> &tags, Anope::string &source, Anope::string &command, std::vector<Anope::string> &params)