aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-08-07 12:19:03 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-08-07 12:19:03 +0100
commit460a82484915f5fcbf34f65194c3437fa2a4e0c7 (patch)
tree6ef6f49a1061c73ac0520594eeadcbc3a3ed593d /lualib
parent662145d0554de5e769b92dab2d41173a98adcee5 (diff)
downloadrspamd-460a82484915f5fcbf34f65194c3437fa2a4e0c7.tar.gz
rspamd-460a82484915f5fcbf34f65194c3437fa2a4e0c7.zip
[Minor] Allow to log configuration errors from plugins
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_util.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua
index 16d009619..800d9fcb7 100644
--- a/lualib/lua_util.lua
+++ b/lualib/lua_util.lua
@@ -408,6 +408,26 @@ end
exports.disable_module = disable_module
--[[[
+-- @function lua_util.push_config_error(module, err)
+-- Pushes a configuration error to the state
+-- @param {string} module name of module
+-- @param {string} err error string
+--]]
+local function push_config_error(module, err)
+ if not rspamd_plugins_state.config_errors then
+ rspamd_plugins_state.config_errors = {}
+ end
+
+ if not rspamd_plugins_state.config_errors[module] then
+ rspamd_plugins_state.config_errors[module] = {}
+ end
+
+ table.insert(rspamd_plugins_state.config_errors[module], err)
+end
+
+exports.push_config_error = push_config_error
+
+--[[[
-- @function lua_util.disable_module(modname)
-- Checks experimental plugins state and disable if needed
-- @param {string} modname name of plugin to check