According doc

/* Exported API to call any Redis command from modules.
 * On success a RedisModuleCallReply object is returned, otherwise
 * NULL is returned and errno is set to the following values:
 *
 * EBADF: wrong format specifier.
 * EINVAL: wrong command arity.
 * ENOENT: command does not exist.
 * EPERM:  operation in Cluster instance with key in non local slot.
 * EROFS:  operation in Cluster instance when a write command is sent
 *         in a readonly state.
 * ENETDOWN: operation in Cluster instance when cluster is down.
 *
 * This API is documented here: https://redis.io/topics/modules-intro
 */
RedisModuleCallReply *RM_Call(RedisModuleCtx *ctx, const char *cmdname, const char *fmt, ...)

errno is set to describe the fail reason.

But I can't find a module api to access that errno value.

Comment From: itamarhaber

Hello @sigoden

The API is a standard - see man errno.

Basically:

#include <errno.h>

if (errno !=0) { ... }

Comment From: sigoden

Ok. I see. thanks.