]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: lua-thread: Add verbosity in errors
authorThierry Fournier <thierry.fournier@ozon.io>
Sun, 29 Nov 2020 10:48:12 +0000 (11:48 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 2 Dec 2020 20:53:16 +0000 (21:53 +0100)
Because lua-load-per-thread could not load the same code for each thread,
this patch displays the state-id associated with the error.

src/hlua.c

index cbe7a99bf85a57e65cbf9061128bf5611efdfb1a..32ea6c97e6dc2fe359fdca687400dcb9af5d329f 100644 (file)
@@ -1347,9 +1347,9 @@ resume_execution:
                lua_pop(lua->T, 1);
                trace = hlua_traceback(lua->T);
                if (msg)
-                       lua_pushfstring(lua->T, "runtime error: %s from %s", msg, trace);
+                       lua_pushfstring(lua->T, "[state-id %d] runtime error: %s from %s", lua->state_id, msg, trace);
                else
-                       lua_pushfstring(lua->T, "unknown runtime error from %s", trace);
+                       lua_pushfstring(lua->T, "[state-id %d] unknown runtime error from %s", lua->state_id, trace);
                ret = HLUA_E_ERRMSG;
                break;
 
@@ -1369,9 +1369,9 @@ resume_execution:
                lua_settop(lua->T, 0); /* Empty the stack. */
                lua_pop(lua->T, 1);
                if (msg)
-                       lua_pushfstring(lua->T, "message handler error: %s", msg);
+                       lua_pushfstring(lua->T, "[state-id %d] message handler error: %s", lua->state_id, msg);
                else
-                       lua_pushfstring(lua->T, "message handler error");
+                       lua_pushfstring(lua->T, "[state-id %d] message handler error", lua->state_id);
                ret = HLUA_E_ERRMSG;
                break;