@@ -414,8 +414,11 @@ int RedisAI_ModelGet_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv,
414414
415415 RAI_Model * mto ;
416416 RedisModuleKey * key ;
417- const int status = RAI_GetModelFromKeyspace (ctx , argv [1 ], & key , & mto , REDISMODULE_READ );
417+ RAI_Error err = {0 };
418+ const int status = RAI_GetModelFromKeyspace (ctx , argv [1 ], & key , & mto , REDISMODULE_READ , & err );
418419 if (status == REDISMODULE_ERR ) {
420+ RedisModule_ReplyWithError (ctx , err .detail );
421+ RAI_ClearError (& err );
419422 return REDISMODULE_ERR ;
420423 }
421424
@@ -434,7 +437,6 @@ int RedisAI_ModelGet_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv,
434437 return RedisModule_ReplyWithError (ctx , "ERR no META or BLOB specified" );
435438 }
436439
437- RAI_Error err = {0 };
438440 char * buffer = NULL ;
439441 size_t len = 0 ;
440442
@@ -512,11 +514,14 @@ int RedisAI_ModelDel_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv,
512514 if (argc != 2 )
513515 return RedisModule_WrongArity (ctx );
514516
517+ RAI_Error err = {0 };
515518 RAI_Model * mto ;
516519 RedisModuleKey * key ;
517- const int status =
518- RAI_GetModelFromKeyspace ( ctx , argv [ 1 ], & key , & mto , REDISMODULE_READ | REDISMODULE_WRITE );
520+ const int status = RAI_GetModelFromKeyspace ( ctx , argv [ 1 ], & key , & mto ,
521+ REDISMODULE_READ | REDISMODULE_WRITE , & err );
519522 if (status == REDISMODULE_ERR ) {
523+ RedisModule_ReplyWithError (ctx , err .detail );
524+ RAI_ClearError (& err );
520525 return REDISMODULE_ERR ;
521526 }
522527
0 commit comments