Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarJsonRpc.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-27 20:23:44 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-27 20:23:44 +1000
commit332983c97b7a729c4dc5f19aa9ee4a22c420f7d8 (patch)
treefd9c441b796b522bdd5c7f8fbd32f51b8eff2a28 /source/core/StarJsonRpc.cpp
parent14b9689b6d4f4ad5276c88130dc6e449bedc0709 (diff)
The Formatting String Catastrophe
Diffstat (limited to 'source/core/StarJsonRpc.cpp')
-rw-r--r--source/core/StarJsonRpc.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/core/StarJsonRpc.cpp b/source/core/StarJsonRpc.cpp
index 60779b9..f6def8f 100644
--- a/source/core/StarJsonRpc.cpp
+++ b/source/core/StarJsonRpc.cpp
@@ -12,7 +12,7 @@ JsonRpc::JsonRpc() {
void JsonRpc::registerHandler(String const& handler, JsonRpcRemoteFunction func) {
if (m_handlers.contains(handler))
- throw JsonRpcException(strf("Handler by that name already exists '%s'", handler));
+ throw JsonRpcException(strf("Handler by that name already exists '{}'", handler));
m_handlers.add(handler, move(func));
}
@@ -23,7 +23,7 @@ void JsonRpc::registerHandlers(JsonRpcHandlers const& handlers) {
void JsonRpc::removeHandler(String const& handler) {
if (!m_handlers.contains(handler))
- throw JsonRpcException(strf("No such handler by the name '%s'", handler));
+ throw JsonRpcException(strf("No such handler by the name '{}'", handler));
m_handlers.remove(handler);
}
@@ -76,14 +76,14 @@ void JsonRpc::receive(ByteArray const& inbuffer) {
try {
auto handlerName = request.getString("handler");
if (!m_handlers.contains(handlerName))
- throw JsonRpcException(strf("Unknown handler '%s'", handlerName));
+ throw JsonRpcException(strf("Unknown handler '{}'", handlerName));
m_pending.append(JsonObject{
{"command", "response"},
{"id", request.get("id")},
{"result", m_handlers[handlerName](request.get("arguments"))}
});
} catch (std::exception& e) {
- Logger::error("Exception while handling variant rpc request handler call. %s", outputException(e, false));
+ Logger::error("Exception while handling variant rpc request handler call. {}", outputException(e, false));
JsonObject response;
response["command"] = "fail";
response["id"] = request.get("id");
@@ -98,7 +98,7 @@ void JsonRpc::receive(ByteArray const& inbuffer) {
auto responseHandler = m_pendingResponse.take(request.getUInt("id"));
responseHandler.fulfill(request.get("result"));
} catch (std::exception& e) {
- Logger::error("Exception while handling variant rpc response handler call. %s", outputException(e, true));
+ Logger::error("Exception while handling variant rpc response handler call. {}", outputException(e, true));
}
} else if (request.get("command") == "fail") {
@@ -106,7 +106,7 @@ void JsonRpc::receive(ByteArray const& inbuffer) {
auto responseHandler = m_pendingResponse.take(request.getUInt("id"));
responseHandler.fulfill({});
} catch (std::exception& e) {
- Logger::error("Exception while handling variant rpc failure handler call. %s", outputException(e, true));
+ Logger::error("Exception while handling variant rpc failure handler call. {}", outputException(e, true));
}
}
}