From bfec2d700b8b0ccf6669e0408b5c5c75299ef47e Mon Sep 17 00:00:00 2001 From: Binbin Date: Wed, 12 Apr 2023 15:11:29 +0800 Subject: Add RM_ReplyWithErrorFormat that can support format (#11923) * Add RM_ReplyWithErrorFormat that can support format Reply with the error create from a printf format and arguments. If the error code is already passed in the string 'fmt', the error code provided is used, otherwise the string "-ERR " for the generic error code is automatically added. The usage is, for example: RedisModule_ReplyWithErrorFormat(ctx, "An error: %s", "foo"); RedisModule_ReplyWithErrorFormat(ctx, "-WRONGTYPE Wrong Type: %s", "foo"); The function always returns REDISMODULE_OK. --- src/server.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/server.h') diff --git a/src/server.h b/src/server.h index 02ec91ee0..b286b6803 100644 --- a/src/server.h +++ b/src/server.h @@ -2553,6 +2553,7 @@ void setDeferredReplyBulkSds(client *c, void *node, sds s); void addReplyErrorObject(client *c, robj *err); void addReplyOrErrorObject(client *c, robj *reply); void afterErrorReply(client *c, const char *s, size_t len, int flags); +void addReplyErrorFormatInternal(client *c, int flags, const char *fmt, va_list ap); void addReplyErrorSdsEx(client *c, sds err, int flags); void addReplyErrorSds(client *c, sds err); void addReplyErrorSdsSafe(client *c, sds err); -- cgit v1.2.1