@@ -412,8 +412,11 @@ int RedisAI_ModelGet_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv,
412412
413413 RAI_Model * mto ;
414414 RedisModuleKey * key ;
415- const int status = RAI_GetModelFromKeyspace (ctx , argv [1 ], & key , & mto , REDISMODULE_READ );
415+ RAI_Error err = {0 };
416+ const int status = RAI_GetModelFromKeyspace (ctx , argv [1 ], & key , & mto , REDISMODULE_READ , & err );
416417 if (status == REDISMODULE_ERR ) {
418+ RedisModule_ReplyWithError (ctx , err .detail );
419+ RAI_ClearError (& err );
417420 return REDISMODULE_ERR ;
418421 }
419422
@@ -432,7 +435,6 @@ int RedisAI_ModelGet_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv,
432435 return RedisModule_ReplyWithError (ctx , "ERR no META or BLOB specified" );
433436 }
434437
435- RAI_Error err = {0 };
436438 char * buffer = NULL ;
437439 size_t len = 0 ;
438440
@@ -510,11 +512,14 @@ int RedisAI_ModelDel_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv,
510512 if (argc != 2 )
511513 return RedisModule_WrongArity (ctx );
512514
515+ RAI_Error err = {0 };
513516 RAI_Model * mto ;
514517 RedisModuleKey * key ;
515- const int status =
516- RAI_GetModelFromKeyspace ( ctx , argv [ 1 ], & key , & mto , REDISMODULE_READ | REDISMODULE_WRITE );
518+ const int status = RAI_GetModelFromKeyspace ( ctx , argv [ 1 ], & key , & mto ,
519+ REDISMODULE_READ | REDISMODULE_WRITE , & err );
517520 if (status == REDISMODULE_ERR ) {
521+ RedisModule_ReplyWithError (ctx , err .detail );
522+ RAI_ClearError (& err );
518523 return REDISMODULE_ERR ;
519524 }
520525
0 commit comments