From edf5b3323456f20d2d10ade0182cd97229d6f79f Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 27 Feb 2023 09:45:46 +0100 Subject: [PATCH] feat: Add stack trace to argument check error Just the error message is not enough to track errors in commonly used functions. --- scripts/mods/dmf/modules/core/misc.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/mods/dmf/modules/core/misc.lua b/scripts/mods/dmf/modules/core/misc.lua index f42091c..7d1864e 100644 --- a/scripts/mods/dmf/modules/core/misc.lua +++ b/scripts/mods/dmf/modules/core/misc.lua @@ -14,8 +14,10 @@ function dmf.check_wrong_argument_type(mod, dmf_function_name, argument_name, ar end end - mod:error("(%s): argument '%s' should have the '%s' type, not '%s'", dmf_function_name, argument_name, - table.concat(allowed_types, "/"), argument_type) + mod:error( + "(%s): argument '%s' should have the '%s' type, not '%s'\n%s", + dmf_function_name, argument_name, table.concat(allowed_types, "/"), argument_type, Script.callstack() + ) return true end