]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Improve errors logging
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 21 Aug 2018 16:16:21 +0000 (17:16 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 21 Aug 2018 16:16:21 +0000 (17:16 +0100)
src/plugins/lua/ratelimit.lua

index f59332f01d1bb64efccfacd2203510604b9a9d9c..05b1f5ed8a26b4977f072e67938b2f96f31979a1 100644 (file)
@@ -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