]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Improve error message when learning with passthrough result
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 12 Aug 2020 18:05:29 +0000 (19:05 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 12 Aug 2020 18:05:29 +0000 (19:05 +0100)
Issue: #3339

src/libstat/stat_process.c

index aed588073e88bb1a771e107970f0adf2ac69c3cd..9cd425206d20b7a37a3fddf0b86c9491fa358eb7 100644 (file)
@@ -679,6 +679,16 @@ rspamd_stat_backends_learn (struct rspamd_stat_ctx *st_ctx,
 
                        if (bk_run == NULL) {
                                /* XXX: must be error */
+                               if (task->result->passthrough_result) {
+                                       /* Passthrough email, cannot learn */
+                                       g_set_error (err, rspamd_stat_quark (), 500,
+                                                       "Cannot learn statistics when passthrough "
+                                                       "result has been set; not classified");
+
+                                       res = FALSE;
+                                       goto end;
+                               }
+
                                msg_warn_task ("no runtime for backend %s; classifier %s; symbol %s",
                                                st->backend->name, cl->cfg->name, st->stcf->symbol);
                                continue;