summaryrefslogtreecommitdiff
path: root/src/process.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-03-12 00:00:36 +0000
committerSadie Powell <sadie@witchery.services>2024-03-12 00:17:49 +0000
commit1538909ac09a0e84269e36a08da5ae9fce92e8f3 (patch)
tree97a986b375f6e1fbfa0df05d017357efdfc4ced1 /src/process.cpp
parenta15f165a1d2d71c3db54d57779bec34914cbc171 (diff)
Add ProtocolException and use it to send fatal errors.
Diffstat (limited to 'src/process.cpp')
-rw-r--r--src/process.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/process.cpp b/src/process.cpp
index eea5bcfe6..f045bc970 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -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)