Change addReplyErrorFormat to addReplyError when there is no format (#12641)

This is just a cleanup, although they are both correct, the change
is normatively better, and addReplyError is also much faster.
Although not important, speed is not important for these error cases.
This commit is contained in:
Binbin 2023-11-30 18:36:17 +08:00 committed by GitHub
parent 423565f784
commit e216c83909
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 5 deletions

View File

@ -2819,8 +2819,7 @@ void aclCommand(client *c) {
sds username = c->argv[2]->ptr; sds username = c->argv[2]->ptr;
/* Check username validity. */ /* Check username validity. */
if (ACLStringHasSpaces(username,sdslen(username))) { if (ACLStringHasSpaces(username,sdslen(username))) {
addReplyErrorFormat(c, addReplyError(c, "Usernames can't contain spaces or null characters");
"Usernames can't contain spaces or null characters");
return; return;
} }

View File

@ -690,7 +690,7 @@ void georadiusGeneric(client *c, int srcKeyIndex, int flags) {
} }
if (any && !count) { if (any && !count) {
addReplyErrorFormat(c, "the ANY argument requires COUNT argument"); addReplyError(c, "the ANY argument requires COUNT argument");
return; return;
} }

View File

@ -1259,7 +1259,7 @@ void replconfCommand(client *c) {
int filter_count, i; int filter_count, i;
sds *filters; sds *filters;
if (!(filters = sdssplitargs(c->argv[j+1]->ptr, &filter_count))) { if (!(filters = sdssplitargs(c->argv[j+1]->ptr, &filter_count))) {
addReplyErrorFormat(c, "Missing rdb-filter-only values"); addReplyError(c, "Missing rdb-filter-only values");
return; return;
} }
/* By default filter out all parts of the rdb */ /* By default filter out all parts of the rdb */

View File

@ -602,7 +602,7 @@ static void luaReplyToRedisReply(client *c, client* script_client, lua_State *lu
* to push 4 elements to the stack. On failure, return error. * to push 4 elements to the stack. On failure, return error.
* Notice that we need, in the worst case, 4 elements because returning a map might * Notice that we need, in the worst case, 4 elements because returning a map might
* require push 4 elements to the Lua stack.*/ * require push 4 elements to the Lua stack.*/
addReplyErrorFormat(c, "reached lua stack limit"); addReplyError(c, "reached lua stack limit");
lua_pop(lua,1); /* pop the element from the stack */ lua_pop(lua,1); /* pop the element from the stack */
return; return;
} }