This is an automated email from the ASF dual-hosted git repository.
twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new a63d48eb feat(conn): add arguments for unknown command message (#2483)
a63d48eb is described below
commit a63d48eb3b77311ed128426cded53810ecb62a5d
Author: Twice <[email protected]>
AuthorDate: Sat Aug 10 16:19:21 2024 +0800
feat(conn): add arguments for unknown command message (#2483)
---
src/server/redis_connection.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/server/redis_connection.cc b/src/server/redis_connection.cc
index 2f00f7cd..5db4c0ee 100644
--- a/src/server/redis_connection.cc
+++ b/src/server/redis_connection.cc
@@ -28,6 +28,7 @@
#include "commands/commander.h"
#include "commands/error_constants.h"
#include "fmt/format.h"
+#include "nonstd/span.hpp"
#include "search/indexer.h"
#include "server/redis_reply.h"
#include "string_util.h"
@@ -382,7 +383,11 @@ void Connection::ExecuteCommands(std::deque<CommandTokens>
*to_process_cmds) {
auto cmd_s = Server::LookupAndCreateCommand(cmd_tokens.front());
if (!cmd_s.IsOK()) {
if (is_multi_exec) multi_error_ = true;
- Reply(redis::Error({Status::NotOK, "unknown command " +
cmd_tokens.front()}));
+ Reply(redis::Error(
+ {Status::NotOK,
+ fmt::format("unknown command `{}`, with args beginning with: {}",
cmd_tokens.front(),
+ util::StringJoin(nonstd::span(cmd_tokens.begin() + 1,
cmd_tokens.end()),
+ [](const auto &v) -> decltype(auto) {
return fmt::format("`{}`", v); }))}));
continue;
}
auto current_cmd = std::move(*cmd_s);