From 1030ca5e6b35232cd15e2673c44ea80f985bb441 Mon Sep 17 00:00:00 2001 From: vitosotdihaet Date: Sat, 17 May 2025 19:14:50 +0300 Subject: [PATCH] fix lua scripts error messages fix lua scripts error messages by adding a full stop between the error message and the script info --- src/script.c | 2 +- src/script_lua.c | 2 +- tests/unit/scripting.tcl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/script.c b/src/script.c index eb45978f8..31c8c3e92 100644 --- a/src/script.c +++ b/src/script.c @@ -400,7 +400,7 @@ static int scriptVerifyWriteCommandAllow(scriptRunCtx *run_ctx, char **err) { if (run_ctx->flags & SCRIPT_READ_ONLY && (run_ctx->c->cmd->flags & (CMD_WRITE|CMD_MAY_REPLICATE))) { - *err = sdsnew("Write commands are not allowed from read-only scripts."); + *err = sdsnew("Write commands are not allowed from read-only scripts"); return C_ERR; } diff --git a/src/script_lua.c b/src/script_lua.c index 47fb59683..53ee81472 100644 --- a/src/script_lua.c +++ b/src/script_lua.c @@ -1668,7 +1668,7 @@ void luaCallFunction(scriptRunCtx* run_ctx, lua_State *lua, robj** keys, size_t final_msg = sdscatfmt(final_msg, "-%s", err_info.msg); if (err_info.line && err_info.source) { - final_msg = sdscatfmt(final_msg, " script: %s, on %s:%s.", + final_msg = sdscatfmt(final_msg, ". script: %s, on %s:%s.", run_ctx->funcname, err_info.source, err_info.line); diff --git a/tests/unit/scripting.tcl b/tests/unit/scripting.tcl index 05a37c00e..0faeb413b 100644 --- a/tests/unit/scripting.tcl +++ b/tests/unit/scripting.tcl @@ -2345,7 +2345,7 @@ start_server {tags {"scripting"}} { assert_equal [ r eval_ro { local t = redis.pcall('set','x','y') - if t['err'] == "ERR Write commands are not allowed from read-only scripts." then + if t['err'] == "ERR Write commands are not allowed from read-only scripts" then return 1 else return 0