[evolution/gnome-2-28] [PATCH] Output an error message on system filter rules loading error



commit 1dcda8555ffe7923442296d176fc7ad6d6b0815d
Author: Yan Li <yanli infradead org>
Date:   Wed Nov 11 18:08:51 2009 +0800

    [PATCH] Output an error message on system filter rules loading error
    
    Without that the user/developer has no way to know when the loading
    failed.

 filter/rule-context.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/filter/rule-context.c b/filter/rule-context.c
index 84cf2e4..6c7f578 100644
--- a/filter/rule-context.c
+++ b/filter/rule-context.c
@@ -1,3 +1,5 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
 /*
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -308,14 +310,22 @@ load(RuleContext *rc, const gchar *system, const gchar *user)
 
 	systemdoc = e_xml_parse_file (system);
 	if (systemdoc == NULL) {
-		rule_context_set_error(rc, g_strdup_printf("Unable to load system rules '%s': %s",
-							     system, g_strerror(errno)));
+		gchar * err_msg = g_strdup_printf("Unable to load system rules '%s': %s",
+						  system, g_strerror(errno));
+		g_warning(err_msg);
+		rule_context_set_error(rc, err_msg);
+		/* no need to free err_msg here */
 		return -1;
 	}
 
 	root = xmlDocGetRootElement(systemdoc);
 	if (root == NULL || strcmp((gchar *)root->name, "filterdescription")) {
-		rule_context_set_error(rc, g_strdup_printf("Unable to load system rules '%s': Invalid format", system));
+		gchar * err_msg = g_strdup_printf(
+			"Unable to load system rules '%s': Invalid format",
+			system);
+		g_warning(err_msg);
+		rule_context_set_error(rc, err_msg);
+		/* no need to free err_msg here */
 		xmlFreeDoc(systemdoc);
 		return -1;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]