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 1c59c909c chore: fix & cleanup RESP error messages (#2902)
1c59c909c is described below
commit 1c59c909c590f2bddcacde421ef160d6d2a065da
Author: Twice <[email protected]>
AuthorDate: Sat Apr 26 17:00:15 2025 +0800
chore: fix & cleanup RESP error messages (#2902)
Signed-off-by: PragmaTwice <[email protected]>
---
src/commands/cmd_json.cc | 2 +-
src/commands/cmd_pubsub.cc | 2 +-
src/commands/cmd_script.cc | 2 +-
tests/gocase/unit/pubsub/pubsubshard_test.go | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/commands/cmd_json.cc b/src/commands/cmd_json.cc
index a18cf903d..be9ebff08 100644
--- a/src/commands/cmd_json.cc
+++ b/src/commands/cmd_json.cc
@@ -661,7 +661,7 @@ class CommandJsonDebug : public Commander {
std::string path = "$";
if (!util::EqualICase(args_[1], "memory")) {
- return {Status::RedisExecErr, "ERR wrong number of arguments for
'json.debug' command"};
+ return {Status::RedisExecErr, "Wrong number of arguments for
'json.debug' command"};
}
if (args_.size() == 4) {
diff --git a/src/commands/cmd_pubsub.cc b/src/commands/cmd_pubsub.cc
index 8aaa7f4ba..0a0cdebd5 100644
--- a/src/commands/cmd_pubsub.cc
+++ b/src/commands/cmd_pubsub.cc
@@ -154,7 +154,7 @@ class CommandSSubscribe : public Commander {
slot = GetSlotIdFromKey(args_[1]);
for (unsigned int i = 2; i < args_.size(); i++) {
if (GetSlotIdFromKey(args_[i]) != slot) {
- return {Status::RedisExecErr, "CROSSSLOT Keys in request don't hash
to the same slot"};
+ return {Status::RedisCrossSlot, "Keys in request don't hash to the
same slot"};
}
}
}
diff --git a/src/commands/cmd_script.cc b/src/commands/cmd_script.cc
index 1b3f287db..8dac03981 100644
--- a/src/commands/cmd_script.cc
+++ b/src/commands/cmd_script.cc
@@ -69,7 +69,7 @@ class CommandScript : public Commander {
// command but some subcommands like `exists` were readonly, so we want to
allow
// executing on slave here. Maybe we should find other way to do this.
if (srv->IsSlave() && subcommand_ != "exists") {
- return {Status::NotOK, "READONLY You can't write against a read only
slave"};
+ return {Status::RedisReadOnly, "You can't write against a read only
slave"};
}
if (args_.size() == 2 && subcommand_ == "flush") {
diff --git a/tests/gocase/unit/pubsub/pubsubshard_test.go
b/tests/gocase/unit/pubsub/pubsubshard_test.go
index 9e8b04cf7..e55cd70f6 100644
--- a/tests/gocase/unit/pubsub/pubsubshard_test.go
+++ b/tests/gocase/unit/pubsub/pubsubshard_test.go
@@ -85,7 +85,7 @@ func TestPubSubShard(t *testing.T) {
// note: when cluster enabled, shard channels
in single command must belong to the same slot
// reference:
https://redis.io/commands/ssubscribe
_, err = pubsub.Receive(ctx)
- require.EqualError(t, err, "ERR CROSSSLOT Keys
in request don't hash to the same slot")
+ require.EqualError(t, err, "CROSSSLOT Keys in
request don't hash to the same slot")
}
err = pubsub.SUnsubscribe(ctx, "multichannel3{tag1}",
"multichannel4{tag2}", "multichannel5{tag2}")