aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-03-11 12:40:03 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-03-11 12:40:03 +0000
commitd17fe6bfce3ff90d38ae641715d07a68ab171be6 (patch)
tree98bfd21fffa05317adef9c55f1b2fefe9412743f /src
parentef7953c47d971e4872655e146dc5c3742079021d (diff)
downloadrspamd-d17fe6bfce3ff90d38ae641715d07a68ab171be6.tar.gz
rspamd-d17fe6bfce3ff90d38ae641715d07a68ab171be6.zip
[Minor] Print failed stage when showing stat error
Diffstat (limited to 'src')
-rw-r--r--src/libserver/task.c71
-rw-r--r--src/libserver/task.h7
2 files changed, 77 insertions, 1 deletions
diff --git a/src/libserver/task.c b/src/libserver/task.c
index 972856f29..30bccb81b 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -819,7 +819,9 @@ rspamd_task_process (struct rspamd_task *task, guint stages)
if (stat_error == NULL) {
g_set_error (&stat_error,
g_quark_from_static_string ("stat"), 500,
- "Unknown statistics error");
+ "Unknown statistics error, found on stage %s;"
+ " classifier: %s",
+ rspamd_task_stage_name (st), task->classifier);
}
if (stat_error->code >= 400) {
@@ -1701,4 +1703,71 @@ rspamd_task_set_finish_time (struct rspamd_task *task)
}
return FALSE;
+}
+
+const gchar *
+rspamd_task_stage_name (enum rspamd_task_stage stg)
+{
+ const gchar *ret = "unknown stage";
+
+ switch (stg) {
+ case RSPAMD_TASK_STAGE_CONNECT:
+ ret = "connect";
+ break;
+ case RSPAMD_TASK_STAGE_ENVELOPE:
+ ret = "envelope";
+ break;
+ case RSPAMD_TASK_STAGE_READ_MESSAGE:
+ ret = "read_message";
+ break;
+ case RSPAMD_TASK_STAGE_PRE_FILTERS:
+ ret = "prefilters";
+ break;
+ case RSPAMD_TASK_STAGE_PROCESS_MESSAGE:
+ ret = "process_message";
+ break;
+ case RSPAMD_TASK_STAGE_FILTERS:
+ ret = "filters";
+ break;
+ case RSPAMD_TASK_STAGE_CLASSIFIERS_PRE:
+ ret = "classifiers_pre";
+ break;
+ case RSPAMD_TASK_STAGE_CLASSIFIERS:
+ ret = "classifiers";
+ break;
+ case RSPAMD_TASK_STAGE_CLASSIFIERS_POST:
+ ret = "classifiers_post";
+ break;
+ case RSPAMD_TASK_STAGE_COMPOSITES:
+ ret = "composites";
+ break;
+ case RSPAMD_TASK_STAGE_POST_FILTERS:
+ ret = "postfilters";
+ break;
+ case RSPAMD_TASK_STAGE_LEARN_PRE:
+ ret = "learn_pre";
+ break;
+ case RSPAMD_TASK_STAGE_LEARN:
+ ret = "learn";
+ break;
+ case RSPAMD_TASK_STAGE_LEARN_POST:
+ ret = "learn_post";
+ break;
+ case RSPAMD_TASK_STAGE_COMPOSITES_POST:
+ ret = "composites_post";
+ break;
+ case RSPAMD_TASK_STAGE_IDEMPOTENT:
+ ret = "idempotent";
+ break;
+ case RSPAMD_TASK_STAGE_DONE:
+ ret = "done";
+ break;
+ case RSPAMD_TASK_STAGE_REPLIED:
+ ret = "replied";
+ break;
+ default:
+ break;
+ }
+
+ return ret;
} \ No newline at end of file
diff --git a/src/libserver/task.h b/src/libserver/task.h
index 684f5c2c0..b97f91eb4 100644
--- a/src/libserver/task.h
+++ b/src/libserver/task.h
@@ -357,4 +357,11 @@ gdouble* rspamd_task_profile_get (struct rspamd_task *task, const gchar *key);
*/
gboolean rspamd_task_set_finish_time (struct rspamd_task *task);
+/**
+ * Returns task processing stage name
+ * @param stg
+ * @return
+ */
+const gchar *rspamd_task_stage_name (enum rspamd_task_stage stg);
+
#endif /* TASK_H_ */