struct classifier_ctx *cl_ctx;
GList *cl_runtimes;
GList *cur;
- gboolean ret = RSPAMD_STAT_PROCESS_ERROR, compat = TRUE;
+ gboolean ret = RSPAMD_STAT_PROCESS_OK, compat = TRUE;
const ucl_object_t *obj;
st_ctx = rspamd_stat_get_ctx ();
gulong nrev;
rspamd_learn_t learn_res = RSPAMD_LEARN_OK;
guint i;
- gboolean compat = TRUE;
+ gboolean compat = TRUE, learned = FALSE;
st_ctx = rspamd_stat_get_ctx ();
g_assert (st_ctx != NULL);
msg_debug ("learned %s classifier %s", spam ? "spam" : "ham",
cl_run->clcf->name);
ret = RSPAMD_STAT_PROCESS_OK;
+ learned = TRUE;
cbdata.classifier_runtimes = cur;
cbdata.task = task;
cur = g_list_next (cur);
}
+ if (!learned) {
+ g_set_error (err, rspamd_stat_quark (), 500, "message cannot be learned"
+ " for any classifier defined");
+ }
+
return ret;
}