1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 00:03:13 +02:00

Use RPC error responses correctly.

This commit is contained in:
Sadie Powell
2025-02-14 20:33:13 +00:00
parent 84b0859e8d
commit 420f83bbbf
5 changed files with 96 additions and 26 deletions
+19 -3
View File
@@ -13,16 +13,32 @@
class RPCRequest final
{
private:
std::optional<std::pair<int64_t, Anope::string>> error;
std::map<Anope::string, Anope::string> replies;
public:
Anope::string name;
Anope::string id;
std::deque<Anope::string> data;
HTTPReply &r;
HTTPReply &reply;
RPCRequest(HTTPReply &r)
: reply(r)
{
}
inline void Error(uint64_t errcode, const Anope::string &errstr)
{
this->error.emplace(errcode, errstr);
}
inline void Reply(const Anope::string &dname, const Anope::string &ddata)
{
this->replies.emplace(dname, ddata);
}
inline const auto &GetError() { return this->error; }
RPCRequest(HTTPReply &_r) : r(_r) { }
inline void Reply(const Anope::string &dname, const Anope::string &ddata) { this->replies.emplace(dname, ddata); }
inline const auto &GetReplies() { return this->replies; }
};