diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-08-21 17:16:21 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-08-21 17:16:21 +0100 |
commit | 017f995b4269e99993f3a7503f5f014859775649 (patch) | |
tree | 119be7552a80d6eff009a5c830ce2d76a3eddd1a /src/plugins | |
parent | 95b1d9bc213b7814b518ec893b970672f62b727e (diff) | |
download | rspamd-017f995b4269e99993f3a7503f5f014859775649.tar.gz rspamd-017f995b4269e99993f3a7503f5f014859775649.zip |
[Minor] Improve errors logging
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/lua/ratelimit.lua | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua index f59332f01..05b1f5ed8 100644 --- a/src/plugins/lua/ratelimit.lua +++ b/src/plugins/lua/ratelimit.lua @@ -647,10 +647,24 @@ if opts then fun.each(function(t, lim) local buckets if type(lim) == 'table' and lim.selector and lim.bucket then + local selector = lua_selectors.parse_selector(rspamd_config, lim.selector) + if not selector then + rspamd_logger.errx(rspamd_config, 'bad ratelimit selector for %s: "%s"', + t, lim.selector) + return + end + local bucket = parse_limit(t, lim.bucket) + + if not bucket then + rspamd_logger.errx(rspamd_config, 'bad ratelimit bucket for %s: "%s"', + t, lim.bucket) + return + end settings.limits[t] = { - selector = lua_selectors.parse_selector(rspamd_config, lim.selector), - buckets = parse_limit(t, lim.bucket) + selector = selector, + buckets = bucket } + else buckets = parse_limit(t, lim) if buckets and #buckets > 0 then |