[libgda] Added error domain for libgda-xslt



commit 6ae85ff1f453e6a731006fd4799a4dfe128d9ab5
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Oct 10 10:12:44 2018 -0500

    Added error domain for libgda-xslt

 libgda-xslt/sql_backend.c | 13 +++++++++++--
 libgda-xslt/sql_backend.h |  8 ++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/libgda-xslt/sql_backend.c b/libgda-xslt/sql_backend.c
index 087f9a574..a02c59612 100644
--- a/libgda-xslt/sql_backend.c
+++ b/libgda-xslt/sql_backend.c
@@ -37,6 +37,15 @@
 
 #include <sql-parser/gda-sql-parser.h>
 
+/* module error */
+GQuark gda_xslt_error_quark (void)
+{
+        static GQuark quark;
+        if (!quark)
+                quark = g_quark_from_static_string ("gda_xslt_error");
+        return quark;
+}
+
 static GHashTable *data_handlers = NULL;       /* key = GType, value = GdaDataHandler obj */
 static xmlChar *value_to_xmlchar (const GValue * value);
 
@@ -359,7 +368,7 @@ get_resultset_nodeset (GdaXsltIntCont * pdata, const char *resultset_name,
 #ifdef GDA_DEBUG_NO
                g_print ("no resultset found\n");
 #endif
-               g_set_error (error, 0, 0,
+               g_set_error (error, GDA_XSLT_ERROR, GDA_XSLT_GENERAL_ERROR,
                             "no resultset found for name [%s]\n",
                             resultset_name);
                *nodeset = NULL;
@@ -394,7 +403,7 @@ _utility_data_model_to_nodeset (GdaDataModel * model,
 #ifdef GDA_DEBUG_NO
                g_print ("xmlNewNode return NULL\n");
 #endif
-               g_set_error (error, 0, 0, "%s", "xmlNewNode return NULL\n");
+               g_set_error (error, GDA_XSLT_ERROR, GDA_XSLT_GENERAL_ERROR, "%s", "xmlNewNode return NULL\n");
                return -1;
        }
        /* compute columns */
diff --git a/libgda-xslt/sql_backend.h b/libgda-xslt/sql_backend.h
index ad843f3c7..c1e81b0dc 100644
--- a/libgda-xslt/sql_backend.h
+++ b/libgda-xslt/sql_backend.h
@@ -36,6 +36,14 @@ G_BEGIN_DECLS
 #define GDA_XSLT_ELEM_INTERNAL_QUERY      "query"
 #define GDA_XSLT_ELEM_INTERNAL_TEMPLATE   "template"
 
+/* error reporting */
+extern GQuark gda_xslt_error_quark (void);
+#define GDA_XSLT_ERROR gda_xslt_error_quark ()
+
+typedef enum {
+       GDA_XSLT_GENERAL_ERROR
+} GdaXsltError;
+
 struct _GdaXsltIntCont
 {
        int         init;


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