[libgda] Partial corrections for bug #660563



commit e9c11d2fde225bb568f879a194c85e74b3c53664
Author: Vivien Malerba <malerba gnome-db org>
Date:   Fri Oct 7 19:09:19 2011 +0200

    Partial corrections for bug #660563

 doc/C/data_validation.xml                          |    4 +-
 libgda-ui/data-entries/plugins/common-pict.c       |   26 +++++---
 libgda-ui/data-entries/plugins/libmain.c           |   18 ++++--
 libgda-ui/gdaui-data-entry.h                       |   10 +++
 libgda-ui/libgda-ui.symbols                        |    1 +
 libgda/gda-connection.c                            |   14 +++--
 libgda/gda-connection.h                            |    3 +-
 libgda/gda-data-model-bdb.c                        |   26 ++++++---
 libgda/gda-data-model-dir.c                        |   59 ++++++++++++------
 libgda/gda-data-model-import.c                     |    2 +-
 libgda/gda-data-proxy.c                            |    2 +-
 libgda/gda-meta-store.c                            |   35 ++++++-----
 libgda/gda-meta-struct-io.c                        |   27 +++++---
 libgda/gda-meta-struct.h                           |    3 +-
 libgda/gda-server-operation.c                      |   24 +++++--
 libgda/gda-server-operation.h                      |    3 +-
 libgda/gda-server-provider.h                       |    4 +-
 libgda/gda-set.c                                   |    5 +-
 libgda/gda-set.h                                   |    3 +-
 libgda/sql-parser/gda-statement-struct-insert.c    |    2 +-
 libgda/sqlite/gda-sqlite-ddl.c                     |    4 +-
 libgda/sqlite/gda-sqlite-provider.c                |   32 +++++++---
 libgda/sqlite/virtual/gda-ldap-connection.c        |    9 ++-
 libgda/sqlite/virtual/gda-vconnection-data-model.c |   13 +++-
 libgda/sqlite/virtual/gda-vconnection-hub.c        |   15 +++--
 libgda/thread-wrapper/gda-thread-provider.c        |   65 ++++++++++++++-----
 providers/firebird/gda-firebird-ddl.c              |    4 +-
 providers/firebird/gda-firebird-provider.c         |    6 +-
 providers/jdbc/gda-jdbc-ddl.c                      |    4 +-
 providers/jdbc/gda-jdbc-provider.c                 |    4 +-
 providers/jdbc/gda-jdbc-util.c                     |   10 ++-
 providers/jdbc/jni-wrapper.c                       |   24 +++++---
 providers/ldap/gda-ldap-util.c                     |   10 ++-
 providers/mysql/gda-mysql-ddl.c                    |   24 ++++++--
 providers/mysql/gda-mysql-provider.c               |   19 ++++--
 providers/oracle/gda-oracle-ddl.c                  |    4 +-
 providers/oracle/gda-oracle-provider.c             |    6 +-
 providers/postgres/gda-postgres-ddl.c              |   22 +++++--
 providers/skel-implementation/capi/gda-capi-ddl.c  |    4 +-
 .../skel-implementation/capi/gda-capi-provider.c   |    6 +-
 providers/web/gda-web-ddl.c                        |    4 +-
 providers/web/gda-web-provider.c                   |   16 ++++-
 tests/providers/prov-test-common.c                 |    4 +-
 tests/providers/prov-test-common.h                 |    4 -
 44 files changed, 396 insertions(+), 188 deletions(-)
---
diff --git a/doc/C/data_validation.xml b/doc/C/data_validation.xml
index 194fa7b..3137f29 100644
--- a/doc/C/data_validation.xml
+++ b/doc/C/data_validation.xml
@@ -39,9 +39,9 @@ my_validate_change_cb (GdaHolder *h, const GValue *value, gpointer data)
 
         /* for example check that value is inferior to 5 and not NULL */
         if (gda_value_is_null (value)) 
-                g_set_error (&amp;error, 0, 0, "NULL values are not allowed!");
+                g_set_error (&amp;error, YOUR_DOMAIN, YOUR_CODE, "NULL values are not allowed!");
         else if (g_value_get_int (value) &gt;= 5)
-                g_set_error (&amp;error, 0, 0, "Value sould be inferior to 5");
+                g_set_error (&amp;error, YOUR_DOMAIN, YOUR_CODE, "Value sould be inferior to 5");
 
         return error;
 }
diff --git a/libgda-ui/data-entries/plugins/common-pict.c b/libgda-ui/data-entries/plugins/common-pict.c
index 9dc04e7..51ce1c1 100644
--- a/libgda-ui/data-entries/plugins/common-pict.c
+++ b/libgda-ui/data-entries/plugins/common-pict.c
@@ -22,6 +22,7 @@
 #include <libgda/gda-quark-list.h>
 #include <libgda/gda-blob-op.h>
 #include <libgda-ui/libgda-ui.h>
+#include <libgda-ui/gdaui-data-entry.h>
 
 /*
  * Fills in @bindata->data and @bindata->data_length with the contents of @value.
@@ -37,7 +38,8 @@ common_pict_load_data (PictOptions *options, const GValue *value, PictBinData *b
 	if (value) {
 		if (gda_value_is_null ((GValue *) value)) {
 			*stock = GTK_STOCK_MISSING_IMAGE;
-			g_set_error (error, 0, 0, _("No data"));
+			g_set_error (error, GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_INVALID_DATA_ERROR,
+				     "%s", _("No data"));
 			allok = FALSE;
 		}
 		else {
@@ -68,8 +70,8 @@ common_pict_load_data (PictOptions *options, const GValue *value, PictBinData *b
 				}
 				else {
 					*stock = GTK_STOCK_DIALOG_ERROR;
-					g_set_error (error, 0, 0,
-						     _("No data"));
+					g_set_error (error, GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_INVALID_DATA_ERROR,
+						     "%s", _("No data"));
 					allok = FALSE;
 				}
 			}
@@ -99,20 +101,23 @@ common_pict_load_data (PictOptions *options, const GValue *value, PictBinData *b
 				}
 				else {
 					*stock = GTK_STOCK_MISSING_IMAGE;
-					g_set_error (error, 0, 0, _("Empty data"));
+					g_set_error (error, GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_INVALID_DATA_ERROR,
+						     "%s", _("Empty data"));
 					allok = FALSE;
 				}
 			}
 			else {
 				*stock = GTK_STOCK_DIALOG_ERROR;
-				g_set_error (error, 0, 0, _("Unhandled type of data"));
+				g_set_error (error, GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_INVALID_DATA_ERROR,
+					     "%s", _("Unhandled type of data"));
 				allok = FALSE;
 			}
 		}
 	}
 	else {
 		*stock = GTK_STOCK_MISSING_IMAGE;
-		g_set_error (error, 0, 0, _("Empty data"));
+		g_set_error (error, GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_INVALID_DATA_ERROR,
+			     "%s", _("Empty data"));
 		allok = FALSE;
 	}
 
@@ -201,7 +206,7 @@ common_pict_make_pixbuf (PictOptions *options, PictBinData *bindata, PictAllocat
 				bindata->data_length = 0;
 
 				*stock = GTK_STOCK_DIALOG_ERROR;
-				g_set_error (error, 0, 0,
+				g_set_error (error, GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_INVALID_DATA_ERROR,
 					     _("Error while deserializing data:\n%s"),
 					     loc_error && loc_error->message ? loc_error->message : _("No detail"));
 
@@ -211,7 +216,7 @@ common_pict_make_pixbuf (PictOptions *options, PictBinData *bindata, PictAllocat
 				retpixbuf = gdk_pixbuf_from_pixdata (&pixdata, FALSE, &loc_error);
 				if (!retpixbuf) {
 					*stock = GTK_STOCK_DIALOG_ERROR;
-					g_set_error (error, 0, 0,
+					g_set_error (error, GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_INVALID_DATA_ERROR,
 						     _("Error while interpreting data as an image:\n%s"),
 						     loc_error && loc_error->message ? loc_error->message : _("No detail"));
 					g_error_free (loc_error);
@@ -258,8 +263,9 @@ common_pict_make_pixbuf (PictOptions *options, PictBinData *bindata, PictAllocat
 				notice_msg = g_strdup_printf (_("Error while interpreting data as an image:\n%s"),
 							      loc_error && loc_error->message ? loc_error->message : _("No detail"));
 				*stock = GTK_STOCK_DIALOG_WARNING;
-				g_set_error_literal (error, loc_error ? loc_error->domain : 0,
-						     loc_error ? loc_error->code : 0, notice_msg);
+				g_set_error_literal (error, loc_error ? loc_error->domain : GDAUI_DATA_ENTRY_ERROR,
+						     loc_error ? loc_error->code : GDAUI_DATA_ENTRY_INVALID_DATA_ERROR,
+						     notice_msg);
 				g_error_free (loc_error);
 				g_free (notice_msg);
 			}
diff --git a/libgda-ui/data-entries/plugins/libmain.c b/libgda-ui/data-entries/plugins/libmain.c
index 217fddc..52241f3 100644
--- a/libgda-ui/data-entries/plugins/libmain.c
+++ b/libgda-ui/data-entries/plugins/libmain.c
@@ -83,7 +83,8 @@ plugin_init (GError **error)
 	file = gda_gbr_get_file_path (GDA_LIB_DIR, LIBGDA_ABI_NAME, "plugins", "gdaui-entry-filesel-spec.xml", NULL);
 	if (! g_file_test (file, G_FILE_TEST_EXISTS)) {
 		if (error && !*error)
-			g_set_error (error, 0, 0, _("Missing spec. file '%s'"), file);
+			g_set_error (error, GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_FILE_NOT_FOUND_ERROR,
+				     _("Missing spec. file '%s'"), file);
         }
 	else {
 		gsize len;
@@ -121,7 +122,8 @@ plugin_init (GError **error)
 	file = gda_gbr_get_file_path (GDA_LIB_DIR, LIBGDA_ABI_NAME, "plugins", "gdaui-entry-password.xml", NULL);
 	if (! g_file_test (file, G_FILE_TEST_EXISTS)) {
 		if (error && !*error)
-			g_set_error (error, 0, 0, _("Missing spec. file '%s'"), file);
+			g_set_error (error,  GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_FILE_NOT_FOUND_ERROR,
+				     _("Missing spec. file '%s'"), file);
         }
 	else {
 		gsize len;
@@ -149,14 +151,16 @@ plugin_init (GError **error)
 	file = gda_gbr_get_file_path (GDA_LIB_DIR, LIBGDA_ABI_NAME, "plugins", "gdaui-entry-text-spec.xml", NULL);
 	if (! g_file_test (file, G_FILE_TEST_EXISTS)) {
 		if (error && !*error)
-			g_set_error (error, 0, 0, _("Missing spec. file '%s'"), file);
+			g_set_error (error,  GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_FILE_NOT_FOUND_ERROR,
+				     _("Missing spec. file '%s'"), file);
         }
 	else {
 		xmlDocPtr doc;
 		doc = xmlParseFile (file);
 		if (!doc) {
 			if (error && !*error)
-				g_set_error (error, 0, 0, _("Missing spec. file '%s'"), file);
+				g_set_error (error,  GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_FILE_NOT_FOUND_ERROR,
+					     _("Missing spec. file '%s'"), file);
 		}
 		else {
 			xmlNodePtr node;
@@ -248,7 +252,8 @@ plugin_init (GError **error)
 	file = gda_gbr_get_file_path (GDA_LIB_DIR, LIBGDA_ABI_NAME, "plugins", "gdaui-entry-pict-spec.xml", NULL);
 	if (! g_file_test (file, G_FILE_TEST_EXISTS)) {
 		if (error && !*error)
-			g_set_error (error, 0, 0, _("Missing spec. file '%s'"), file);
+			g_set_error (error, GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_FILE_NOT_FOUND_ERROR,
+				     _("Missing spec. file '%s'"), file);
         }
 	else {
 		gsize len;
@@ -272,7 +277,8 @@ plugin_init (GError **error)
 	file = gda_gbr_get_file_path (GDA_LIB_DIR, LIBGDA_ABI_NAME, "plugins", "gdaui-entry-pict-spec_string.xml", NULL);
 	if (! g_file_test (file, G_FILE_TEST_EXISTS)) {
 		if (error && !*error)
-			g_set_error (error, 0, 0, _("Missing spec. file '%s'"), file);
+			g_set_error (error,  GDAUI_DATA_ENTRY_ERROR, GDAUI_DATA_ENTRY_FILE_NOT_FOUND_ERROR,
+				     _("Missing spec. file '%s'"), file);
         }
 	else {
 		gsize len;
diff --git a/libgda-ui/gdaui-data-entry.h b/libgda-ui/gdaui-data-entry.h
index 8de9818..ac0157d 100644
--- a/libgda-ui/gdaui-data-entry.h
+++ b/libgda-ui/gdaui-data-entry.h
@@ -35,6 +35,16 @@ G_BEGIN_DECLS
 typedef struct _GdauiDataEntry        GdauiDataEntry;
 typedef struct _GdauiDataEntryIface   GdauiDataEntryIface;
 
+/* error reporting */
+extern GQuark gdaui_data_entry_error_quark (void);
+#define GDAUI_DATA_ENTRY_ERROR gdaui_data_entry_error_quark ()
+
+typedef enum
+{
+	GDAUI_DATA_ENTRY_FILE_NOT_FOUND_ERROR,
+	GDAUI_DATA_ENTRY_INVALID_DATA_ERROR
+} GdauiDataEntryError;
+
 /* struct for the interface */
 struct _GdauiDataEntryIface
 {
diff --git a/libgda-ui/libgda-ui.symbols b/libgda-ui/libgda-ui.symbols
index 81731ba..a247e2a 100644
--- a/libgda-ui/libgda-ui.symbols
+++ b/libgda-ui/libgda-ui.symbols
@@ -42,6 +42,7 @@
 	gdaui_data_cell_renderer_textual_new
 	gdaui_data_entry_content_is_valid
 	gdaui_data_entry_can_expand
+	gdaui_data_entry_error_quark
 	gdaui_data_entry_get_attributes
 	gdaui_data_entry_get_editable
 	gdaui_data_entry_get_handler
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index d9df542..147588d 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -4235,8 +4235,9 @@ check_parameters (GdaMetaContext *context, GError **error, gint nb, ...)
 		for (j = 0; j < nb_params; j++) {
 			GValue *v = *(spec_array[j].pvalue);
 			if (v && (gda_value_is_null (v) || (G_VALUE_TYPE (v) != spec_array[j].type))) {
-				g_set_error (error, 0, 0, "%s", 
-					     _("Invalid argument"));
+				g_set_error (error, GDA_CONNECTION_ERROR,
+					     GDA_CONNECTION_META_DATA_CONTEXT_ERROR,
+					     "%s", _("Invalid argument"));
 				retval = -1;
 			}
 		}
@@ -4244,8 +4245,10 @@ check_parameters (GdaMetaContext *context, GError **error, gint nb, ...)
 	else {
 		gchar *str;
 		str = meta_context_stringify (context);
-		g_set_error (error, 0, 0,
-			     _("Missing or wrong arguments for table '%s': %s"), context->table_name, str);
+		g_set_error (error, GDA_CONNECTION_ERROR,
+			     GDA_CONNECTION_META_DATA_CONTEXT_ERROR,
+			     _("Missing or wrong arguments for table '%s': %s"),
+			     context->table_name, str);
 		g_free (str);
 	}
 
@@ -4998,7 +5001,8 @@ suggest_update_cb_downstream (G_GNUC_UNUSED GdaMetaStore *store, GdaMetaContext
 		if (lerror)
 			data->error = lerror;
 		else {
-			g_set_error (&lerror, 0, 0,
+			g_set_error (&lerror,GDA_CONNECTION_ERROR,
+				     GDA_CONNECTION_META_DATA_CONTEXT_ERROR,
 				      "%s", _("Meta update error"));
 			data->error = lerror;
 		}
diff --git a/libgda/gda-connection.h b/libgda/gda-connection.h
index 7cb200e..8509f9f 100644
--- a/libgda/gda-connection.h
+++ b/libgda/gda-connection.h
@@ -62,7 +62,8 @@ typedef enum {
 	GDA_CONNECTION_CANT_LOCK_ERROR,
 	GDA_CONNECTION_TASK_NOT_FOUND_ERROR,
 	GDA_CONNECTION_UNSUPPORTED_THREADS_ERROR,
-	GDA_CONNECTION_CLOSED_ERROR
+	GDA_CONNECTION_CLOSED_ERROR,
+	GDA_CONNECTION_META_DATA_CONTEXT_ERROR
 } GdaConnectionError;
 
 #define GDA_CONNECTION_NONEXIST_DSN_ERROR GDA_CONNECTION_DSN_NOT_FOUND_ERROR
diff --git a/libgda/gda-data-model-bdb.c b/libgda/gda-data-model-bdb.c
index e43e027..1113100 100644
--- a/libgda/gda-data-model-bdb.c
+++ b/libgda/gda-data-model-bdb.c
@@ -25,6 +25,7 @@
 #include <libgda/gda-data-model-bdb.h>
 #include <db.h>
 #include <gmodule.h>
+#include <libgda/gda-server-provider.h>
 
 #define BDB_VERSION  (10000*DB_VERSION_MAJOR+100*DB_VERSION_MINOR+DB_VERSION_PATCH)
 
@@ -213,7 +214,8 @@ add_error (GdaDataModelBdb *model, const gchar *err)
 {
 	GError *error = NULL;
 
-        g_set_error (&error, 0, 0, "%s", err);
+        g_set_error (&error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+		     "%s", err);
         model->priv->errors = g_slist_append (model->priv->errors, error);
 }
 
@@ -826,8 +828,11 @@ alter_key_value (GdaDataModelBdb *model, DBT *key, GList **values, gboolean *has
 						*has_modifications = TRUE;
 				}
 				else {
-					g_set_error (error, 0, 0, _("Custom BDB model implementation is not complete: "
-								    "the '%s' method is missing"), "update_key_part");
+					g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+						     GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
+						     _("Custom BDB model implementation is not complete: "
+						       "the '%s' method is missing"),
+						     "update_key_part");
 					return FALSE;
 				}
 			}
@@ -852,7 +857,7 @@ alter_key_value (GdaDataModelBdb *model, DBT *key, GList **values, gboolean *has
 					*has_modifications = TRUE;
 			}
 			else {
-				g_set_error (error, 0, 0,
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
 					     _("Expected GdaBinary value, got %s"), g_type_name (G_VALUE_TYPE (v)));
 				return FALSE;
 			}
@@ -914,8 +919,11 @@ gda_data_model_bdb_set_values (GdaDataModel *model, gint row, GList *values, GEr
 						return FALSE;
 				}
 				else {
-					g_set_error (error, 0, 0, _("Custom BDB model implementation is not complete: "
-								    "the '%s' method is missing"), "update_data_part");
+					g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
++						     GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
+						     _("Custom BDB model implementation is not complete: "
+						       "the '%s' method is missing"),
+						     "update_data_part");
 					return FALSE;
 				}
 			}
@@ -938,8 +946,10 @@ gda_data_model_bdb_set_values (GdaDataModel *model, gint row, GList *values, GEr
 				data.data = bin->data;
 			}
 			else {
-				g_set_error (error, 0, 0,
-					     _("Expected GdaBinary value, got %s"), g_type_name (G_VALUE_TYPE (v)));
+				g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+					     GDA_SERVER_PROVIDER_DATA_ERROR,
+					     _("Expected GdaBinary value, got %s"),
+					     g_type_name (G_VALUE_TYPE (v)));
 				return FALSE;
 			}
 		}
diff --git a/libgda/gda-data-model-dir.c b/libgda/gda-data-model-dir.c
index b3e553a..371be09 100644
--- a/libgda/gda-data-model-dir.c
+++ b/libgda/gda-data-model-dir.c
@@ -251,7 +251,8 @@ add_error (GdaDataModelDir *model, const gchar *err)
 {
 	GError *error = NULL;
 
-        g_set_error (&error, 0, 0, "%s", err);
+        g_set_error (&error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+		     "%s", err);
         model->priv->errors = g_slist_append (model->priv->errors, error);
 }
 
@@ -925,7 +926,8 @@ gda_data_model_dir_set_value_at (GdaDataModel *model, gint col, gint row, const
 		gchar *tmp;
 		tmp = g_strdup_printf (_("Column %d out of range (0-%d)"), col, COL_LAST-1);
 		add_error (imodel, tmp);
-		g_set_error (error, 0, 0, "%s", tmp);
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_COLUMN_OUT_OF_RANGE_ERROR,
+			     "%s", tmp);
 		g_free (tmp);
 		return FALSE;
 	}
@@ -971,7 +973,8 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
 		else
 			str = g_strdup_printf (_("Row %d not found (empty data model)"), row);
 		add_error (imodel, str);
-		g_set_error (error, 0, 0, "%s", str);
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ROW_OUT_OF_RANGE_ERROR,
+			     "%s", str);
 		g_free (str);
                 return FALSE;
         }
@@ -992,8 +995,8 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
 		case COL_MD5SUM:
 		default:
 			add_error (imodel, _("Column cannot be modified"));
-			g_set_error (error, 0, 0, "%s",
-				     _("Column cannot be modified"));
+			g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+				     "%s", _("Column cannot be modified"));
 			return FALSE;
 		case COL_DIRNAME: {
 			/* check that the new dir still starts with the basedir */
@@ -1006,8 +1009,10 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
 			base_len = strlen (imodel->priv->basedir);
 			if ((len < base_len) ||
 			    (strncmp (new_path, imodel->priv->basedir, base_len))) {
-				add_error (imodel, _("New path must be a subpath of the base directory"));
-				g_set_error (error, 0, 0, "%s",
+				add_error (imodel,
+					   _("New path must be a subpath of the base directory"));
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+					     "%s",
 					     _("New path must be a subpath of the base directory"));
 				return FALSE;
 			}
@@ -1051,7 +1056,9 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
 					str = g_strdup_printf (_("Could not rename file '%s' to '%s'"),
 							       filename, new_filename);
 					add_error (imodel, str);
-					g_set_error (error, 0, 0, "%s", str);
+					g_set_error (error,
+						     GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+						     "%s", str);
 					g_free (str);
 					g_free (new_filename);
 					g_free (filename);
@@ -1074,7 +1081,8 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
 				gchar *str;
 				str = g_strdup_printf (_("Could not create directory '%s'"), new_path);
 				add_error (imodel, str);
-				g_set_error (error, 0, 0, "%s", str);
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+					     "%s", str);
 				g_free (str);
 				g_free (old_path);
 				return FALSE;
@@ -1094,7 +1102,8 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
 				gchar *str;
 				str = g_strdup_printf (_("Could not rename file '%s' to '%s'"), filename, new_filename);
 				add_error (imodel, str);
-				g_set_error (error, 0, 0, "%s", str);
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+					     "%s", str);
 				g_free (str);
 				g_free (new_filename);
 				g_free (filename);
@@ -1143,7 +1152,9 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
 					gchar *str;
 					str = g_strdup_printf (_("Could not overwrite contents of file '%s'"), filename);
 					add_error (imodel, str);
-					g_set_error (error, 0, 0, "%s", str);
+					g_set_error (error, GDA_DATA_MODEL_ERROR,
+						     GDA_DATA_MODEL_ACCESS_ERROR,
+						     "%s", str);
 					g_free (str);
 					g_object_unref (op);
 					g_free (filename);
@@ -1160,7 +1171,8 @@ gda_data_model_dir_set_values (GdaDataModel *model, gint row, GList *values, GEr
 			}
 			else {
 				add_error (imodel, _("Wrong type of data"));
-				g_set_error (error, 0, 0, "%s", _("Wrong type of data"));
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+					     "%s", _("Wrong type of data"));
 				return FALSE;
 			}
 			break;
@@ -1202,7 +1214,8 @@ gda_data_model_dir_append_values (GdaDataModel *model, const GList *values, GErr
 		case COL_MD5SUM:
 		default:
 			add_error (imodel, _("Column cannot be set"));
-			g_set_error (error, 0, 0, "%s",
+			g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+				     "%s",
 				     _("Column cannot be set"));
 			return -1;
 		case COL_DIRNAME:
@@ -1214,7 +1227,9 @@ gda_data_model_dir_append_values (GdaDataModel *model, const GList *values, GErr
 				if ((len < base_len) ||
 				    (strncmp (dirname, imodel->priv->basedir, base_len))) {
 					add_error (imodel, _("New path must be a subpath of the base directory"));
-					g_set_error (error, 0, 0, "%s",
+					g_set_error (error, GDA_DATA_MODEL_ERROR,
+						     GDA_DATA_MODEL_ACCESS_ERROR,
+						     "%s",
 						     _("New path must be a subpath of the base directory"));
 					return -1;
 				}
@@ -1276,7 +1291,8 @@ gda_data_model_dir_append_values (GdaDataModel *model, const GList *values, GErr
 				gchar *str;
 				str = g_strdup_printf (_("Cannot set contents of filename '%s'"), complete_filename);
 				add_error (imodel, str);
-				g_set_error (error, 0, 0, "%s", str);
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+					     "%s", str);
 				g_free (str);
 				if (bin_to_free)
 					g_free (bin_data);
@@ -1287,15 +1303,16 @@ gda_data_model_dir_append_values (GdaDataModel *model, const GList *values, GErr
 			gchar *str;
 			str = g_strdup_printf (_("Cannot create directory '%s'"), dirname);
 			add_error (imodel, str);
-			g_set_error (error, 0, 0, "%s", str);
+			g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+				     "%s", str);
 			g_free (str);
 			return -1;
 		}
 	}
 	else {
 		add_error (imodel, _("Cannot add row: filename missing"));
-		g_set_error (error, 0, 0, "%s",
-			     _("Cannot add row: filename missing"));
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+			     "%s", _("Cannot add row: filename missing"));
 		return -1;
 	}
 
@@ -1322,7 +1339,8 @@ gda_data_model_dir_remove_row (GdaDataModel *model, gint row, GError **error)
 		else
 			str = g_strdup_printf (_("Row %d not found (empty data model)"), row);
 		add_error (imodel, str);
-		g_set_error (error, 0, 0, "%s", str);
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+			     "%s", str);
 		g_free (str);
                 return FALSE;
         }
@@ -1338,7 +1356,8 @@ gda_data_model_dir_remove_row (GdaDataModel *model, gint row, GError **error)
 		gchar *str;
 		str = g_strdup_printf (_("Cannot remove file '%s'"), filename);
 		add_error (imodel, str);
-		g_set_error (error, 0, 0, "%s", str);
+		g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR,
+			     "%s", str);
 		g_free (str);
 		g_free (filename);
 		return FALSE;
diff --git a/libgda/gda-data-model-import.c b/libgda/gda-data-model-import.c
index 127f6a6..9c88e29 100644
--- a/libgda/gda-data-model-import.c
+++ b/libgda/gda-data-model-import.c
@@ -1686,7 +1686,7 @@ add_error (GdaDataModelImport *model, const gchar *err)
 {
 	GError *error = NULL;
 
-	g_set_error (&error, 0, 0, "%s", err);
+	g_set_error (&error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_ACCESS_ERROR, "%s", err);
 	model->priv->errors = g_slist_append (model->priv->errors, error);
 }
 
diff --git a/libgda/gda-data-proxy.c b/libgda/gda-data-proxy.c
index c5f9ff1..ceec98c 100644
--- a/libgda/gda-data-proxy.c
+++ b/libgda/gda-data-proxy.c
@@ -3906,7 +3906,7 @@ gda_data_proxy_set_values (GdaDataModel *model, gint row, GList *values, GError
 			GdaColumn *column;
 			column = gda_data_model_describe_column (model, col);
 			if (gda_column_get_g_type (column) != G_VALUE_TYPE (value)) {
-				g_set_error (error, GDA_DATA_PROXY_ERROR, 0,
+				g_set_error (error, GDA_DATA_MODEL_ERROR, GDA_DATA_MODEL_VALUE_TYPE_ERROR,
 					     _("Value type mismatch %s instead of %s"),
 					     gda_g_type_to_string (G_VALUE_TYPE (value)),
 					     gda_g_type_to_string (gda_column_get_g_type (column)));
diff --git a/libgda/gda-meta-store.c b/libgda/gda-meta-store.c
index 3b2d4b3..19503cd 100644
--- a/libgda/gda-meta-store.c
+++ b/libgda/gda-meta-store.c
@@ -1230,8 +1230,8 @@ create_view_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr no
 
 	view_name = xmlGetProp (node, BAD_CAST "name");
 	if (!view_name) {
-		g_set_error (error, 0, 0, "%s",
-			     _("Missing view name from <view> node"));
+		g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_META_CONTEXT_ERROR,
+			     "%s", _("Missing view name from <view> node"));
 		goto onerror;
 	}
 
@@ -1270,8 +1270,8 @@ create_view_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr no
 			continue;
 		def = xmlNodeGetContent (cnode);
 		if (!def) {
-			g_set_error (error, 0, 0, "%s",
-				     _("Missing view definition from <view> node"));
+			g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_META_CONTEXT_ERROR,
+				     "%s", _("Missing view definition from <view> node"));
 			goto onerror;
 		}
 
@@ -1284,7 +1284,7 @@ create_view_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr no
 			goto onerror;
 		}
 		if (remain) {
-			g_set_error (error, 0, 0,
+			g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_META_CONTEXT_ERROR,
 				     _("View definition contains more than one statement (for view '%s')"),
 				     complete_obj_name);
 			g_object_unref (stmt);
@@ -1311,7 +1311,7 @@ create_view_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr no
 #endif
 		}
 		else {
-			g_set_error (error, 0, 0,
+			g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_META_CONTEXT_ERROR,
 				     _("View definition is not a selection statement (for view '%s')"),
 				     complete_obj_name);
 			g_object_unref (stmt);
@@ -1338,8 +1338,8 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
 
 	table_name = xmlGetProp (node, BAD_CAST "name");
 	if (!table_name) {
-		g_set_error (error, 0, 0, "%s",
-			     _("Missing table name from <table> node"));
+		g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_SCHEMA_OBJECT_DESCR_ERROR,
+			     "%s", _("Missing table name from <table> node"));
 		return NULL;
 	}
 
@@ -1376,7 +1376,7 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
 	TABLE_INFO (dbobj)->current_all = compute_prepared_stmt (klass->cpriv->parser, sql);
 	g_free (sql);
 	if (!TABLE_INFO (dbobj)->current_all) {
-		g_set_error (error, 0, 0,
+		g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_INTERNAL_ERROR,
 			     "Internal fatal error: could not create SELECT ALL statement (for table '%s')",
 			     complete_obj_name);
 		goto onerror;
@@ -1387,7 +1387,7 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
 	TABLE_INFO (dbobj)->delete_all = compute_prepared_stmt (klass->cpriv->parser, sql);
 	g_free (sql);
 	if (!TABLE_INFO (dbobj)->delete_all) {
-		g_set_error (error, 0, 0,
+		g_set_error (error, GDA_META_STORE_ERROR, GDA_META_STORE_INTERNAL_ERROR,
 			     "Internal fatal error: could not create DELETE ALL statement (for table '%s')",
 			     complete_obj_name);
 		goto onerror;
@@ -1569,7 +1569,8 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
 					    (! tcol->column_type && ctype) ||
 					    (tcol->column_type && !ctype) ||
 					    (tcol->column_type && strcmp (tcol->column_type, (gchar *) ctype))) {
-						g_set_error (error, 0, 0,
+						g_set_error (error, GDA_META_STORE_ERROR,
+							     GDA_META_STORE_SCHEMA_OBJECT_DESCR_ERROR,
 							     _("Column '%s' already exists and has different characteristics"),
 							     tcol->column_name);
 						xmlFree (cname);
@@ -1603,7 +1604,8 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
 
 			ref_table = xmlGetProp (cnode, BAD_CAST "ref_table");
 			if (!ref_table) {
-				g_set_error (error, 0, 0,
+				g_set_error (error, GDA_META_STORE_ERROR,
+					     GDA_META_STORE_SCHEMA_OBJECT_DESCR_ERROR,
 					     _("Missing foreign key's referenced table name (for table '%s')"),
 					     complete_obj_name);
 				goto onerror;
@@ -1656,7 +1658,8 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
 					continue;
 				col = xmlGetProp (fnode, BAD_CAST "column");
 				if (!col) {
-					g_set_error (error, 0, 0,
+					g_set_error (error, GDA_META_STORE_ERROR,
+						     GDA_META_STORE_SCHEMA_OBJECT_DESCR_ERROR,
 						     _("Missing foreign key's column name (for table '%s')"),
 						     complete_obj_name);
 					table_fkey_free (tfk);
@@ -1667,7 +1670,8 @@ create_table_object (GdaMetaStoreClass *klass, GdaMetaStore *store, xmlNodePtr n
 											(gchar *) col);
 				tfk->fk_names_array [fkcolindex] = g_strdup ((gchar *) col);
 				if (tfk->fk_cols_array [fkcolindex] < 0) {
-					g_set_error (error, 0, 0,
+					g_set_error (error, GDA_META_STORE_ERROR,
+						     GDA_META_STORE_SCHEMA_OBJECT_DESCR_ERROR,
 						     _("Column '%s' not found in table '%s'"), (gchar *) col,
 						     complete_obj_name);
 					table_fkey_free (tfk);
@@ -1921,7 +1925,8 @@ complement_db_objects (GSList *objects, G_GNUC_UNUSED GHashTable *hash, GError *
 				gint col;
 				col = column_name_to_index (TABLE_INFO (tfk->depend_on), tfk->ref_pk_names_array[i]);
 				if (col < 0) {
-					g_set_error (error, 0, 0,
+					g_set_error (error, GDA_META_STORE_ERROR,
+						     GDA_META_STORE_META_CONTEXT_ERROR,
 						     _("Foreign key column '%s' not found in table '%s'"),
 						     tfk->ref_pk_names_array[i], tfk->depend_on->obj_name);
 					if (cond)
diff --git a/libgda/gda-meta-struct-io.c b/libgda/gda-meta-struct-io.c
index 528335a..692839f 100644
--- a/libgda/gda-meta-struct-io.c
+++ b/libgda/gda-meta-struct-io.c
@@ -78,14 +78,14 @@ gda_meta_struct_load_from_xml_file (GdaMetaStruct *mstruct, const gchar *catalog
 	/* load information schema's structure XML file */
 	doc = xmlParseFile (xml_spec_file);
 	if (!doc) {
-		g_set_error (error, GDA_META_STRUCT_ERROR, 0, /* FIXME */
+		g_set_error (error, GDA_META_STRUCT_ERROR, GDA_META_STRUCT_XML_ERROR,
 			     _("Could not load file '%s'"), xml_spec_file);
 		return FALSE;
 	}
 	
 	node = xmlDocGetRootElement (doc);
 	if (!node || strcmp ((gchar *) node->name, "schema")) {
-		g_set_error (error, GDA_META_STRUCT_ERROR, 0, /* FIXME */
+		g_set_error (error, GDA_META_STRUCT_ERROR, GDA_META_STRUCT_XML_ERROR,
 			     _("Root node of file '%s' should be <schema>."), xml_spec_file);
 		xmlFreeDoc (doc);
 		return FALSE;
@@ -172,7 +172,7 @@ create_table_object (GdaMetaStruct *mstruct, const GValue *catalog, const gchar
 
 	table_name = xmlGetProp (node, BAD_CAST "name");
 	if (!table_name) {
-		g_set_error (error, GDA_META_STRUCT_ERROR, 0, /* FIXME */
+		g_set_error (error, GDA_META_STRUCT_ERROR, GDA_META_STRUCT_XML_ERROR,
 			     "%s", _("Missing table name from <table> node"));
 		return NULL;
 	}
@@ -231,8 +231,10 @@ create_table_object (GdaMetaStruct *mstruct, const GValue *catalog, const gchar
                                 continue;
                         cname = xmlGetProp (cnode, BAD_CAST "name");
                         if (!cname) {
-				g_set_error (error, GDA_META_STRUCT_ERROR, 0, /* FIXME */
-					     _("Missing column name for table '%s'"), dbobj->obj_full_name);
+				g_set_error (error, GDA_META_STRUCT_ERROR,
+					     GDA_META_STRUCT_XML_ERROR,
+					     _("Missing column name for table '%s'"),
+					     dbobj->obj_full_name);
 				goto onerror;
 			}
 			xstr = xmlGetProp (cnode, BAD_CAST "pkey");
@@ -285,7 +287,8 @@ create_table_object (GdaMetaStruct *mstruct, const GValue *catalog, const gchar
 
 			ref_table = xmlGetProp (cnode, BAD_CAST "ref_table");
 			if (!ref_table) {
-				g_set_error (error, GDA_META_STRUCT_ERROR, 0, /* FIXME */
+				g_set_error (error, GDA_META_STRUCT_ERROR,
+					     GDA_META_STRUCT_XML_ERROR,
 					     _("Missing foreign key's referenced table name for table '%s'"), 
 					     dbobj->obj_full_name);
 				goto onerror;
@@ -296,19 +299,22 @@ create_table_object (GdaMetaStruct *mstruct, const GValue *catalog, const gchar
 			gchar *name_part, *schema_part, *catalog_part = NULL;
 			gchar *tmp = g_strdup ((gchar *) ref_table);
 			if (!_split_identifier_string (tmp, &schema_part, &name_part)) {
-				g_set_error (error, GDA_META_STRUCT_ERROR, 0, /* FIXME */
+				g_set_error (error, GDA_META_STRUCT_ERROR,
+					     GDA_META_STRUCT_XML_ERROR,
 					     _("Invalid referenced table name '%s'"), ref_table);
 				xmlFree (ref_table);
 				goto onerror;
 			}
 			if (schema_part && !_split_identifier_string (schema_part, &catalog_part, &schema_part)) {
-				g_set_error (error, GDA_META_STRUCT_ERROR, 0, /* FIXME */
+				g_set_error (error, GDA_META_STRUCT_ERROR,
+					     GDA_META_STRUCT_XML_ERROR,
 					     _("Invalid referenced table name '%s'"), ref_table);
 				xmlFree (ref_table);
 				goto onerror;
 			}
 			if (catalog_part) {
-				g_set_error (error, GDA_META_STRUCT_ERROR, 0, /* FIXME */
+				g_set_error (error, GDA_META_STRUCT_ERROR,
+					     GDA_META_STRUCT_XML_ERROR,
 					     _("Invalid referenced table name '%s'"), ref_table);
 				xmlFree (ref_table);
 				goto onerror;
@@ -347,7 +353,8 @@ create_table_object (GdaMetaStruct *mstruct, const GValue *catalog, const gchar
 					continue;
 				col = xmlGetProp (fnode, BAD_CAST "column");
 				if (!col) {
-					g_set_error (error, GDA_META_STRUCT_ERROR, 0, /* FIXME */
+					g_set_error (error, GDA_META_STRUCT_ERROR,
+						     GDA_META_STRUCT_XML_ERROR,
 						     _("Missing foreign key's column name for table '%s'"), 
 						     dbobj->obj_full_name);
 					g_array_free (fk_names_array, TRUE);
diff --git a/libgda/gda-meta-struct.h b/libgda/gda-meta-struct.h
index 17b7b9a..3bd0c72 100644
--- a/libgda/gda-meta-struct.h
+++ b/libgda/gda-meta-struct.h
@@ -40,7 +40,8 @@ extern GQuark gda_meta_struct_error_quark (void);
 typedef enum {
 	GDA_META_STRUCT_UNKNOWN_OBJECT_ERROR,
         GDA_META_STRUCT_DUPLICATE_OBJECT_ERROR,
-        GDA_META_STRUCT_INCOHERENCE_ERROR
+        GDA_META_STRUCT_INCOHERENCE_ERROR,
+	GDA_META_STRUCT_XML_ERROR
 } GdaMetaStructError;
 
 
diff --git a/libgda/gda-server-operation.c b/libgda/gda-server-operation.c
index 6fd3c85..5375f98 100644
--- a/libgda/gda-server-operation.c
+++ b/libgda/gda-server-operation.c
@@ -1495,7 +1495,8 @@ gda_server_operation_load_data_from_xml (GdaServerOperation *op, xmlNodePtr node
 
 	/* actual data loading */
 	if (strcmp ((gchar*)node->name, "serv_op_data")) {
-		g_set_error (error, 0, 0,
+		g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+			     GDA_SERVER_OPERATION_XML_ERROR,
 			     _("Expected tag <%s>, got <%s>"), "serv_op_data", node->name);
 		return FALSE;
 	}
@@ -1509,7 +1510,8 @@ gda_server_operation_load_data_from_xml (GdaServerOperation *op, xmlNodePtr node
 		}
 
 		if (strcmp ((gchar*)cur->name, "op_data")) {
-			g_set_error (error, 0, 0,
+			g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+				     GDA_SERVER_OPERATION_XML_ERROR,
 				     _("Expected tag <%s>, got <%s>"), "op_data", cur->name);
 			return FALSE;
 		}
@@ -1540,7 +1542,10 @@ gda_server_operation_load_data_from_xml (GdaServerOperation *op, xmlNodePtr node
 				switch (opnode->type) {
 				case GDA_SERVER_OPERATION_NODE_PARAMLIST:
 					if (!extension) {
-						g_set_error (error, 0, 0, "%s", 
+						g_set_error (error,
+							     GDA_SERVER_OPERATION_ERROR,
+							     GDA_SERVER_OPERATION_XML_ERROR,
+							     "%s", 
 							     _("Parameterlist values can only be set for individual parameters within it"));
 						allok = FALSE;
 					}
@@ -1597,8 +1602,9 @@ gda_server_operation_load_data_from_xml (GdaServerOperation *op, xmlNodePtr node
 				return FALSE;
 		}
 		else {
-			g_set_error (error, 0, 0, "%s", 
-				     _("Missing attribute named 'path'"));
+			g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+				     GDA_SERVER_OPERATION_XML_ERROR,
+				     "%s", _("Missing attribute named 'path'"));
 			return FALSE;
 		}
 		
@@ -2256,7 +2262,9 @@ gda_server_operation_set_value_at_path (GdaServerOperation *op, const gchar *val
 		switch (opnode->type) {
 		case GDA_SERVER_OPERATION_NODE_PARAMLIST:
 			if (!extension) {
-				g_set_error (error, 0, 0, "%s", 
+				g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+					     GDA_SERVER_OPERATION_XML_ERROR,
+					     "%s", 
 					     _("Parameterlist values can only be set for individual parameters within it"));
 				allok = FALSE;
 			}
@@ -2446,7 +2454,9 @@ gda_server_operation_is_valid (GdaServerOperation *op, const gchar *xml_file, GE
 					value = gda_server_operation_get_value_at (op, path);
 					if (!value) {
 						valid = FALSE;
-						g_set_error (error, 0, 0,
+						g_set_error (error,
+							     GDA_SERVER_OPERATION_ERROR,
+							     GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
 							     _("Missing required value for '%s'"), path);
 						break;
 					}
diff --git a/libgda/gda-server-operation.h b/libgda/gda-server-operation.h
index b00dd08..cec195f 100644
--- a/libgda/gda-server-operation.h
+++ b/libgda/gda-server-operation.h
@@ -72,7 +72,8 @@ extern GQuark gda_server_operation_error_quark (void);
 
 typedef enum {
 	GDA_SERVER_OPERATION_OBJECT_NAME_ERROR,
-	GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR
+	GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+	GDA_SERVER_OPERATION_XML_ERROR
 } GdaServerOperationError;
 
 typedef enum
diff --git a/libgda/gda-server-provider.h b/libgda/gda-server-provider.h
index e5fca1a..c0397e5 100644
--- a/libgda/gda-server-provider.h
+++ b/libgda/gda-server-provider.h
@@ -59,7 +59,9 @@ typedef enum
 	GDA_SERVER_PROVIDER_NON_SUPPORTED_ERROR,
 	GDA_SERVER_PROVIDER_SERVER_VERSION_ERROR,
 	GDA_SERVER_PROVIDER_DATA_ERROR,
-	GDA_SERVER_PROVIDER_DEFAULT_VALUE_HANDLING_ERROR
+	GDA_SERVER_PROVIDER_DEFAULT_VALUE_HANDLING_ERROR,
+	GDA_SERVER_PROVIDER_MISUSE_ERROR,
+	GDA_SERVER_PROVIDER_FILE_NOT_FOUND_ERROR
 } GdaServerProviderError;
 
 struct _GdaServerProvider {
diff --git a/libgda/gda-set.c b/libgda/gda-set.c
index 9f83cb3..58fb091 100644
--- a/libgda/gda-set.c
+++ b/libgda/gda-set.c
@@ -655,7 +655,7 @@ gda_set_set_holder_value (GdaSet *set, GError **error, const gchar *holder_id, .
 	else if (type == G_TYPE_GTYPE)
 		g_value_set_gtype (value, va_arg (ap, GType));	
 	else {
-		g_set_error (error, 0, 0,
+		g_set_error (error, GDA_SET_ERROR, GDA_SET_IMPLEMENTATION_ERROR,
 			     _("%s() does not handle values of type '%s'."),
 			     __FUNCTION__, g_type_name (type));
 		va_end (ap);
@@ -850,7 +850,8 @@ gda_set_new_from_spec_node (xmlNodePtr xml_spec, GError **error)
 				errors = gda_data_model_import_get_errors (GDA_DATA_MODEL_IMPORT (model));
 				if (errors) {
 					GError *err = (GError *) errors->data;
-					g_set_error (error, 0, 0, "%s", err->message);
+					g_set_error (error, GDA_SET_ERROR, GDA_SET_XML_SPEC_ERROR,
+						     "%s", err->message);
 					g_object_unref (model);
 					model = NULL;
 					allok = FALSE;
diff --git a/libgda/gda-set.h b/libgda/gda-set.h
index c6b8ad3..fda5317 100644
--- a/libgda/gda-set.h
+++ b/libgda/gda-set.h
@@ -41,7 +41,8 @@ typedef enum
 	GDA_SET_XML_SPEC_ERROR,
 	GDA_SET_HOLDER_NOT_FOUND_ERROR,
 	GDA_SET_INVALID_ERROR,
-	GDA_SET_READ_ONLY_ERROR
+	GDA_SET_READ_ONLY_ERROR,
+	GDA_SET_IMPLEMENTATION_ERROR
 } GdaSetError;
 
 struct _GdaSetNode {
diff --git a/libgda/sql-parser/gda-statement-struct-insert.c b/libgda/sql-parser/gda-statement-struct-insert.c
index 8452065..de828e0 100644
--- a/libgda/sql-parser/gda-statement-struct-insert.c
+++ b/libgda/sql-parser/gda-statement-struct-insert.c
@@ -410,7 +410,7 @@ gda_sql_statement_insert_check_structure (GdaSqlAnyPart *stmt, G_GNUC_UNUSED gpo
 						g_set_error (error, GDA_SQL_ERROR, GDA_SQL_STRUCTURE_CONTENTS_ERROR,
 							      "%s", _("INSERT statement does not have the same number of target columns and expressions"));
 					else
-						g_set_error (error, GDA_SQL_ERROR, 0,
+						g_set_error (error, GDA_SQL_ERROR, GDA_SQL_STRUCTURE_CONTENTS_ERROR,
 							      "%s", _("VALUES lists must all be the same length in INSERT statement"));
 					return FALSE;
 				}
diff --git a/libgda/sqlite/gda-sqlite-ddl.c b/libgda/sqlite/gda-sqlite-ddl.c
index 590872c..dec0dac 100644
--- a/libgda/sqlite/gda-sqlite-ddl.c
+++ b/libgda/sqlite/gda-sqlite-ddl.c
@@ -217,7 +217,9 @@ _gda_sqlite_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc
 
 	if (!hasfields) {
 		allok = FALSE;
-		g_set_error (error, 0, 0, "%s", _("Table to create must have at least one row"));
+		g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+			     GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+			     "%s", _("Table to create must have at least one row"));
 	}
 
 	sql = string->str;
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index cd67727..e270a31 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -1184,7 +1184,9 @@ gda_sqlite_provider_create_operation (GdaServerProvider *provider, G_GNUC_UNUSED
 			return op;
 		}
 		else {
-			g_set_error (error, 0, 0, _("Missing spec. file '%s'"), str);
+			g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+				     GDA_SERVER_OPERATION_XML_ERROR,
+				     _("Missing spec. file '%s'"), str);
 			g_free (str);
 			return NULL;
 		}
@@ -1224,7 +1226,9 @@ gda_sqlite_provider_render_operation (GdaServerProvider *provider, GdaConnection
 		const gchar *contents;
 		contents = emb_get_file (str);
 		if (!contents) {
-			g_set_error (error, 0, 0, _("Missing spec. file '%s'"), str);
+			g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+				     GDA_SERVER_OPERATION_XML_ERROR,
+				     _("Missing spec. file '%s'"), str);
 			g_free (str);
 			return NULL;
 		}
@@ -1319,7 +1323,9 @@ gda_sqlite_provider_perform_operation (GdaServerProvider *provider, GdaConnectio
 		g_free (filename);
 
 		if (errmsg != SQLITE_OK) {
-			g_set_error (error, 0, 0, "%s", SQLITE3_CALL (sqlite3_errmsg) (cdata->connection));
+			g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+				     GDA_SERVER_PROVIDER_PREPARE_STMT_ERROR,
+				     "%s", SQLITE3_CALL (sqlite3_errmsg) (cdata->connection));
 			retval = FALSE;
 		}
 
@@ -1333,7 +1339,9 @@ gda_sqlite_provider_perform_operation (GdaServerProvider *provider, GdaConnectio
 			errmsg = SQLITE3_CALL (sqlite3_key) (cdata->connection, (void*) passphrase,
 							     strlen (passphrase));
 			if (errmsg != SQLITE_OK) {
-				g_set_error (error, 0, 0, "%s", SQLITE3_CALL (sqlite3_errmsg) (cdata->connection));
+				g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+					     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+					     "%s", SQLITE3_CALL (sqlite3_errmsg) (cdata->connection));
 				retval = FALSE;
 			}
 			else {
@@ -1345,7 +1353,9 @@ gda_sqlite_provider_perform_operation (GdaServerProvider *provider, GdaConnectio
 								      &pStmt, NULL);
 
 				if (res != SQLITE_OK) {
-					g_set_error (error, 0, 0, "%s",
+					g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+						     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+						     "%s",
 						     _("Error initializing database with passphrase"));
 					retval = FALSE;
 					goto outcontents;
@@ -1354,7 +1364,9 @@ gda_sqlite_provider_perform_operation (GdaServerProvider *provider, GdaConnectio
 				SQLITE3_CALL (sqlite3_reset) (pStmt);
 				SQLITE3_CALL (sqlite3_finalize) (pStmt);
 				if (res != SQLITE_DONE) {
-					g_set_error (error, 0, 0, "%s",
+					g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+						     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+						     "%s",
 						     _("Error initializing database with passphrase"));
 					retval = FALSE;
 					goto outcontents;
@@ -1366,7 +1378,9 @@ gda_sqlite_provider_perform_operation (GdaServerProvider *provider, GdaConnectio
 								      &pStmt, NULL);
 
 				if (res != SQLITE_OK) {
-					g_set_error (error, 0, 0, "%s",
+					g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+						     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+						     "%s",
 						     _("Error initializing database with passphrase"));
 					retval = FALSE;
 					goto outcontents;
@@ -1375,7 +1389,9 @@ gda_sqlite_provider_perform_operation (GdaServerProvider *provider, GdaConnectio
 				SQLITE3_CALL (sqlite3_reset) (pStmt);
 				SQLITE3_CALL (sqlite3_finalize) (pStmt);
 				if (res != SQLITE_DONE) {
-					g_set_error (error, 0, 0, "%s",
+					g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+						     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+						     "%s",
 						     _("Error initializing database with passphrase"));
 					retval = FALSE;
 					goto outcontents;
diff --git a/libgda/sqlite/virtual/gda-ldap-connection.c b/libgda/sqlite/virtual/gda-ldap-connection.c
index 66c26df..68c08f1 100644
--- a/libgda/sqlite/virtual/gda-ldap-connection.c
+++ b/libgda/sqlite/virtual/gda-ldap-connection.c
@@ -768,7 +768,8 @@ gda_ldap_connection_undeclare_table (GdaLdapConnection *cnc, const gchar *table_
 
 	specs =  gda_vconnection_data_model_get (GDA_VCONNECTION_DATA_MODEL (cnc), table_name);
 	if (specs && ! g_slist_find (cnc->priv->maps, specs)) {
-		g_set_error (error, 0, 0,
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
 			     _("Can't remove non LDAP virtual table"));
 		return FALSE;
 	}
@@ -815,13 +816,15 @@ gda_ldap_connection_describe_table (GdaLdapConnection *cnc, const gchar *table_n
 
 	specs =  gda_vconnection_data_model_get (GDA_VCONNECTION_DATA_MODEL (cnc), table_name);
 	if (specs && ! g_slist_find (cnc->priv->maps, specs)) {
-		g_set_error (error, 0, 0,
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
 			     _("Can't describe non LDAP virtual table"));
 		return FALSE;
 	}
 	
 	if (!specs) {
-		g_set_error (error, 0, 0,
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
 			     _("Unknown LDAP virtual table"));
 		return FALSE;
 	}
diff --git a/libgda/sqlite/virtual/gda-vconnection-data-model.c b/libgda/sqlite/virtual/gda-vconnection-data-model.c
index 5c1bb8e..7a2472d 100644
--- a/libgda/sqlite/virtual/gda-vconnection-data-model.c
+++ b/libgda/sqlite/virtual/gda-vconnection-data-model.c
@@ -320,7 +320,9 @@ gda_vconnection_data_model_add (GdaVconnectionDataModel *cnc, GdaVconnectionData
 	rc = SQLITE3_CALL (sqlite3_exec) (scnc->connection, str, NULL, 0, &zErrMsg);
 	g_free (str);
 	if (rc != SQLITE_OK) {
-		g_set_error (error, 0, 0, "%s", zErrMsg);
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+			     "%s", zErrMsg);
 		SQLITE3_CALL (sqlite3_free) (zErrMsg);
 		gda_vconnection_data_model_table_data_free (td);
 		cnc->priv->table_data_list = g_slist_remove (cnc->priv->table_data_list, td);
@@ -367,8 +369,9 @@ gda_vconnection_data_model_remove (GdaVconnectionDataModel *cnc, const gchar *ta
 
 	td = gda_vconnection_get_table_data_by_name (cnc, table_name);
 	if (!td) {
-		g_set_error (error, 0, 0, "%s",
-			     _("Table to remove not found"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("Table to remove not found"));
 		return FALSE;
 	}
 
@@ -377,7 +380,9 @@ gda_vconnection_data_model_remove (GdaVconnectionDataModel *cnc, const gchar *ta
 	g_free (str);
 
 	if (rc != SQLITE_OK) {
-		g_set_error (error, 0, 0, "%s", zErrMsg);
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+			     "%s", zErrMsg);
 		SQLITE3_CALL (sqlite3_free) (zErrMsg);
 		return FALSE;
 	}
diff --git a/libgda/sqlite/virtual/gda-vconnection-hub.c b/libgda/sqlite/virtual/gda-vconnection-hub.c
index d308951..39c1477 100644
--- a/libgda/sqlite/virtual/gda-vconnection-hub.c
+++ b/libgda/sqlite/virtual/gda-vconnection-hub.c
@@ -154,8 +154,9 @@ gda_vconnection_hub_add (GdaVconnectionHub *hub,
 	/* check for constraints */
 	hc = get_hub_cnc_by_ns (hub, ns);
 	if (hc && (hc->cnc != cnc)) {
-		g_set_error (error, 0, 0, "%s",
-			     _("Namespace must be specified"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("Namespace must be specified"));
 		return FALSE;
 	}
 
@@ -163,8 +164,9 @@ gda_vconnection_hub_add (GdaVconnectionHub *hub,
 		return TRUE;
 
 	if (!gda_connection_is_opened (cnc)) {
-		g_set_error (error, 0, 0, "%s",
-			     _("Connection is closed"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("Connection is closed"));
 		return FALSE;
 	}
 
@@ -204,8 +206,9 @@ gda_vconnection_hub_remove (GdaVconnectionHub *hub, GdaConnection *cnc, GError *
 	hc = get_hub_cnc_by_cnc (hub, cnc);
 
 	if (!hc) {
-		g_set_error (error, 0, 0, "%s",
-			     _("Connection was not represented in hub"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("Connection was not represented in hub"));
 		return FALSE;
 	}
 
diff --git a/libgda/thread-wrapper/gda-thread-provider.c b/libgda/thread-wrapper/gda-thread-provider.c
index 92680d8..45dd92c 100644
--- a/libgda/thread-wrapper/gda-thread-provider.c
+++ b/libgda/thread-wrapper/gda-thread-provider.c
@@ -812,7 +812,9 @@ gda_thread_provider_create_operation (GdaServerProvider *provider, GdaConnection
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return NULL;
 	}
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
@@ -865,7 +867,9 @@ gda_thread_provider_render_operation (GdaServerProvider *provider, GdaConnection
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return NULL;
 	}
 	g_return_val_if_fail (GDA_IS_CONNECTION (cnc), FALSE);
@@ -919,13 +923,16 @@ gda_thread_provider_perform_operation (GdaServerProvider *provider, GdaConnectio
 
 	/* If asynchronous connection opening is not supported, then exit now */
 	if (async_cb) {
-		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
 			     "%s", _("Provider does not support asynchronous server operation"));
                 return FALSE;
 	}
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
@@ -980,7 +987,9 @@ gda_thread_provider_begin_transaction (GdaServerProvider *provider, GdaConnectio
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
@@ -1035,7 +1044,9 @@ gda_thread_provider_commit_transaction (GdaServerProvider *provider, GdaConnecti
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
@@ -1082,7 +1093,9 @@ gda_thread_provider_rollback_transaction (GdaServerProvider *provider, GdaConnec
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
@@ -1129,7 +1142,9 @@ gda_thread_provider_add_savepoint (GdaServerProvider *provider, GdaConnection *c
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
@@ -1176,7 +1191,9 @@ gda_thread_provider_rollback_savepoint (GdaServerProvider *provider, GdaConnecti
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
@@ -1223,7 +1240,9 @@ gda_thread_provider_delete_savepoint (GdaServerProvider *provider, GdaConnection
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
@@ -1622,7 +1641,7 @@ gda_thread_provider_statement_execute (GdaServerProvider *provider, GdaConnectio
 
 	if (check_cnc_closed (cnc, cdata)) {
 		g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_CLOSED_ERROR,
-			     _("Connection is closed"));
+			     "%s", _("Connection is closed"));
 		return NULL;
 	}
 	
@@ -1753,7 +1772,9 @@ gda_thread_provider_xa_start (GdaServerProvider *provider, GdaConnection *cnc,
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
@@ -1802,7 +1823,9 @@ gda_thread_provider_xa_end (GdaServerProvider *provider, GdaConnection *cnc,
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
@@ -1850,7 +1873,9 @@ gda_thread_provider_xa_prepare (GdaServerProvider *provider, GdaConnection *cnc,
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
@@ -1899,7 +1924,9 @@ gda_thread_provider_xa_commit (GdaServerProvider *provider, GdaConnection *cnc,
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
@@ -1947,7 +1974,9 @@ gda_thread_provider_xa_rollback (GdaServerProvider *provider, GdaConnection *cnc
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
@@ -1996,7 +2025,9 @@ gda_thread_provider_xa_recover (GdaServerProvider *provider, GdaConnection *cnc,
 	guint jid;
 
 	if (!cnc) {
-		g_set_error (error, 0, 0, _("A connection is required"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", _("A connection is required"));
 		return FALSE;
 	}
 
diff --git a/providers/firebird/gda-firebird-ddl.c b/providers/firebird/gda-firebird-ddl.c
index 6cc41c8..7e71ca3 100644
--- a/providers/firebird/gda-firebird-ddl.c
+++ b/providers/firebird/gda-firebird-ddl.c
@@ -131,7 +131,9 @@ gda_firebird_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
 
 	if (!hasfields) {
 		allok = FALSE;
-		g_set_error (error, 0, 0, "%s", _("Table to create must have at least one row"));
+		g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+			     GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+			     "%s", _("Table to create must have at least one row"));
 	}
 	g_slist_free (pkfields);
 
diff --git a/providers/firebird/gda-firebird-provider.c b/providers/firebird/gda-firebird-provider.c
index 3e53d24..6dd008c 100644
--- a/providers/firebird/gda-firebird-provider.c
+++ b/providers/firebird/gda-firebird-provider.c
@@ -551,7 +551,8 @@ gda_firebird_provider_create_operation (GdaServerProvider *provider, GdaConnecti
         g_free (str);
 
         if (! file) {
-                g_set_error (error, 0, 0, _("Missing spec. file '%s'"), file);
+                g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_FILE_NOT_FOUND_ERROR,
+			     _("Missing spec. file '%s'"), file);
                 return NULL;
         }
 
@@ -589,7 +590,8 @@ gda_firebird_provider_render_operation (GdaServerProvider *provider, GdaConnecti
         g_free (str);
 
         if (! file) {
-                g_set_error (error, 0, 0, _("Missing spec. file '%s'"), file);
+                g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_FILE_NOT_FOUND_ERROR,
+			     _("Missing spec. file '%s'"), file);
                 return NULL;
         }
         if (!gda_server_operation_is_valid (op, file, error)) {
diff --git a/providers/jdbc/gda-jdbc-ddl.c b/providers/jdbc/gda-jdbc-ddl.c
index fec1916..d035035 100644
--- a/providers/jdbc/gda-jdbc-ddl.c
+++ b/providers/jdbc/gda-jdbc-ddl.c
@@ -137,7 +137,9 @@ gda_jdbc_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
 
 	if (!hasfields) {
 		allok = FALSE;
-		g_set_error (error, 0, 0, "%s", _("Table to create must have at least one row"));
+		g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+                             GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+			     "%s", _("Table to create must have at least one row"));
 	}
 
 	sql = string->str;
diff --git a/providers/jdbc/gda-jdbc-provider.c b/providers/jdbc/gda-jdbc-provider.c
index ad9ed04..0ac3bc2 100644
--- a/providers/jdbc/gda-jdbc-provider.c
+++ b/providers/jdbc/gda-jdbc-provider.c
@@ -1834,8 +1834,8 @@ gda_jdbc_provider_new (const gchar *jdbc_driver, GError **error)
 	g_return_val_if_fail (jdbc_driver, NULL);
 
 	if (!_jdbc_provider_java_vm) {
-		g_set_error (error, 0, 0, "%s", 
-			     "No JVM runtime identified (this should not happen at this point)!");
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+			     "%s", "No JVM runtime identified (this should not happen at this point)!");
 		return NULL;
 	}
 
diff --git a/providers/jdbc/gda-jdbc-util.c b/providers/jdbc/gda-jdbc-util.c
index 71c76f0..68542f2 100644
--- a/providers/jdbc/gda-jdbc-util.c
+++ b/providers/jdbc/gda-jdbc-util.c
@@ -81,14 +81,16 @@ _gda_jdbc_get_jenv (gboolean *out_needs_detach, GError **error)
 	atres = (*_jdbc_provider_java_vm)->GetEnv (_jdbc_provider_java_vm, (void**) &env, JNI_VERSION_1_2);
 	if (atres == JNI_EDETACHED) {
 		if ((*_jdbc_provider_java_vm)->AttachCurrentThread (_jdbc_provider_java_vm, (void**) &env, NULL) < 0)
-			g_set_error (error, 0, 0, "%s", 
-				     "Could not attach JAVA virtual machine's current thread");
+			g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+				     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+				     "%s", "Could not attach JAVA virtual machine's current thread");
 		else
 			*out_needs_detach = TRUE;
 	}
 	else if (atres == JNI_EVERSION)
-		g_set_error (error, 0, 0, "%s", 
-			     "Could not attach JAVA virtual machine's current thread");
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+			     "%s", "Could not attach JAVA virtual machine's current thread");
 	return env;
 }
 
diff --git a/providers/jdbc/jni-wrapper.c b/providers/jdbc/jni-wrapper.c
index 57537c2..55b9927 100644
--- a/providers/jdbc/jni-wrapper.c
+++ b/providers/jdbc/jni-wrapper.c
@@ -20,6 +20,7 @@
  */
 #include <jni-wrapper.h>
 #include <gda-value.h>
+#include <gda-server-provider.h>
 
 gboolean jni_wrapper_describe_exceptions = TRUE;
 
@@ -93,8 +94,8 @@ jni_wrapper_create_vm (JavaVM **out_jvm, CreateJavaVMFunc create_func,
 {
 	*out_jvm = NULL;
 #ifndef JNI_VERSION_1_2
-	g_set_error (error, 0, 0, "%s", 
-		     "Java 1.2 or more is needed");
+	g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_MISUSE_ERROR,
+		     "%s", "Java 1.2 or more is needed");
 	return NULL;
 #else
 	GString *classpath = NULL;
@@ -107,7 +108,8 @@ jni_wrapper_create_vm (JavaVM **out_jvm, CreateJavaVMFunc create_func,
 	const gchar *tmp;
 
 	if (!create_func) {
-		g_set_error (error, 0, 0, "%s", 
+		g_set_error (error,GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+			     "%s", 
 			     "The JNI_CreateJavaVM is not identified (as the create_func argument)");
 		return NULL;
 	}
@@ -166,8 +168,8 @@ jni_wrapper_create_vm (JavaVM **out_jvm, CreateJavaVMFunc create_func,
 	g_string_free (classpath, TRUE);
 	g_free (options[2].optionString);
 	if ((result == JNI_ERR) || !env) {
-		g_set_error (error, 0, 0, "%s", 
-			     "Can't invoke the JVM");
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+			     "%s", "Can't invoke the JVM");
 		return NULL;
 	}
 
@@ -378,7 +380,9 @@ jni_wrapper_handle_exception (JNIEnv *jenv, gint *out_error_code, gchar **out_sq
 			
 			if (res) {
 				if (G_VALUE_TYPE (res) == G_TYPE_STRING) {
-					g_set_error (error, 0, 0, "%s", g_value_get_string (res));
+					g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+						     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+						     "%s", g_value_get_string (res));
 					gda_value_free (res);
 				}
 				else {
@@ -398,7 +402,9 @@ jni_wrapper_handle_exception (JNIEnv *jenv, gint *out_error_code, gchar **out_sq
 	return TRUE;
 
  fallback:
-	g_set_error (error, 0, 0, "%s", "An exception occurred");
+	g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+		     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+		     "%s", "An exception occurred");
 	gda_value_free (exc_value);
 	(*jenv)->DeleteLocalRef(jenv, exc);
 	return TRUE;
@@ -980,8 +986,8 @@ jni_wrapper_field_set (JNIEnv *jenv, JniWrapperField *field,
 	return TRUE;
 
  wrong_type:
-	g_set_error (error, 0, 0, "%s", 
-		     "Wrong value type");
+	g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+		     "%s", "Wrong value type");
 	return FALSE;
 }
 
diff --git a/providers/ldap/gda-ldap-util.c b/providers/ldap/gda-ldap-util.c
index 47b2230..afed931 100644
--- a/providers/ldap/gda-ldap-util.c
+++ b/providers/ldap/gda-ldap-util.c
@@ -1138,8 +1138,10 @@ gdaprov_ldap_describe_entry (GdaLdapConnection *cnc, const gchar *dn, GError **e
 			return NULL;
 		}
 		else if (nb_entries > 1) {
-			g_set_error (error, 0, 0,
-				     _("LDAP server returned more than one entry with DN '%s'"), real_dn);
+			g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+				     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+				     _("LDAP server returned more than one entry with DN '%s'"),
+				     real_dn);
 			return NULL;
 		}
 
@@ -1270,7 +1272,9 @@ gdaprov_ldap_get_entry_children (GdaLdapConnection *cnc, const gchar *dn, gchar
 				}
 				g_array_free (children, TRUE);
 				children = NULL;
-				g_set_error (error, 0, 0,
+				g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+					     GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+					     "%s",
 					     _("Could not parse distinguished name returned by LDAP server"));
 				break;
 			}
diff --git a/providers/mysql/gda-mysql-ddl.c b/providers/mysql/gda-mysql-ddl.c
index 71cb1a4..75f3365 100644
--- a/providers/mysql/gda-mysql-ddl.c
+++ b/providers/mysql/gda-mysql-ddl.c
@@ -258,7 +258,9 @@ gda_mysql_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
 				node = gda_server_operation_get_node_info (op, "/FKEY_S/%d/FKEY_FIELDS_A", i);
 				if (!node || ((nbfields = gda_data_model_get_n_rows (node->model)) == 0)) {
 					allok = FALSE;
-					g_set_error (error, 0, 0, "%s", _("No field specified in foreign key constraint"));
+					g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+						     GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+						     "%s", _("No field specified in foreign key constraint"));
 				}
 				else {
 					for (j = 0; j < nbfields; j++) {
@@ -272,7 +274,9 @@ gda_mysql_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
 						}
 						else {
 							allok = FALSE;
-							g_set_error (error, 0, 0, "%s",  
+							g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+								     GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+								     "%s",  
 								     _("Empty field specified in foreign key constraint"));
 						}
 					}
@@ -286,7 +290,9 @@ gda_mysql_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
 				}
 				else {
 					allok = FALSE;
-					g_set_error (error, 0, 0, "%s", _("No referenced table specified in foreign key constraint"));
+					g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+						     GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+						     "%s", _("No referenced table specified in foreign key constraint"));
 				}
 
 				g_string_append (string, " (");
@@ -301,7 +307,9 @@ gda_mysql_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
 					}
 					else {
 						allok = FALSE;
-						g_set_error (error, 0, 0, "%s",  
+						g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+							     GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+							     "%s",  
 							     _("Empty referenced field specified in foreign key constraint"));
 					}
 				}
@@ -323,7 +331,9 @@ gda_mysql_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
 
 	if (!hasfields) {
 		allok = FALSE;
-		g_set_error (error, 0, 0, "%s", _("Table to create must have at least one row"));
+		g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+                             GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+			     "%s", _("Table to create must have at least one row"));
 	}
 
 	/* other options */
@@ -915,7 +925,9 @@ gda_mysql_render_CREATE_VIEW (GdaServerProvider *provider, GdaConnection *cnc,
 				g_free (tmp);
 			}
 			else {
-				g_set_error (error, 0, 0, "%s", _("Incorrect specified column name"));
+				g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+					     GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+					     "%s", _("Incorrect specified column name"));
 				allok = FALSE;
 			}
 		}
diff --git a/providers/mysql/gda-mysql-provider.c b/providers/mysql/gda-mysql-provider.c
index 41f30b1..2ac7a65 100644
--- a/providers/mysql/gda-mysql-provider.c
+++ b/providers/mysql/gda-mysql-provider.c
@@ -489,7 +489,8 @@ real_open_connection (const gchar  *host,
 
 	/* Exclusive: host/pair otherwise unix socket. */
 	if ((host || port > 0) && socket) {
-		g_set_error (error, 0, 0, "%s", 
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_MISUSE_ERROR,
+			     "%s", 
 			     _("Cannot give a UNIX SOCKET if you also provide "
 			       "either a HOST or a PORT"));
 		return NULL;
@@ -519,7 +520,8 @@ real_open_connection (const gchar  *host,
 						  (port > 0) ? port : 0,
 						  socket, flags);
 	if (!return_mysql || mysql != return_mysql) {
-		g_set_error_literal (error, GDA_SERVER_PROVIDER_ERROR, 0, mysql_error (mysql));
+		g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_OPEN_ERROR,
+			     "%s", mysql_error (mysql));
 		g_free (mysql);
 		mysql = NULL;
 	}
@@ -529,7 +531,8 @@ real_open_connection (const gchar  *host,
 #if MYSQL_VERSION_ID < 32200
 	if (mysql &&
 	    mysql_select_db (mysql, db) != 0) {
-		g_set_error (error, 0, 0, "%s", mysql_error (mysql));
+		g_set_error (error, GDA_CONNECTION_ERROR, GDA_CONNECTION_OPEN_ERROR,
+			     "%s", mysql_error (mysql));
 		g_free (mysql);
 		mysql = NULL;
 	}
@@ -853,7 +856,8 @@ gda_mysql_provider_create_operation (GdaServerProvider       *provider,
 	g_free (dir);
 
         if (!file) {
-                g_set_error (error, 0, 0, _("Missing spec. file '%s'"), str);
+                g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_FILE_NOT_FOUND_ERROR,
+			     _("Missing spec. file '%s'"), str);
 		g_free (str);
                 return NULL;
         }
@@ -894,7 +898,8 @@ gda_mysql_provider_render_operation (GdaServerProvider   *provider,
 	g_free (dir);
 
         if (!file) {
-                g_set_error (error, 0, 0, _("Missing spec. file '%s'"), str);
+                g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_FILE_NOT_FOUND_ERROR,
+			     _("Missing spec. file '%s'"), str);
 		g_free (str);
                 return NULL;
         }
@@ -1030,7 +1035,9 @@ gda_mysql_provider_perform_operation (GdaServerProvider               *provider,
 			g_free (sql);
 			
 			if (res) {
-			  g_set_error (error, 0, 0, "%s", mysql_error (mysql));
+			  g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+				       GDA_SERVER_PROVIDER_OPERATION_ERROR,
+				       "%s", mysql_error (mysql));
 				mysql_close (mysql);
 				return FALSE;
 			}
diff --git a/providers/oracle/gda-oracle-ddl.c b/providers/oracle/gda-oracle-ddl.c
index a95f5d8..0cf7271 100644
--- a/providers/oracle/gda-oracle-ddl.c
+++ b/providers/oracle/gda-oracle-ddl.c
@@ -137,7 +137,9 @@ gda_oracle_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
 
 	if (!hasfields) {
 		allok = FALSE;
-		g_set_error (error, 0, 0, "%s", _("Table to create must have at least one row"));
+		g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+                             GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+			     "%s", _("Table to create must have at least one row"));
 	}
 
 	sql = string->str;
diff --git a/providers/oracle/gda-oracle-provider.c b/providers/oracle/gda-oracle-provider.c
index 1b8f4bc..e6d075d 100644
--- a/providers/oracle/gda-oracle-provider.c
+++ b/providers/oracle/gda-oracle-provider.c
@@ -877,7 +877,8 @@ gda_oracle_provider_create_operation (GdaServerProvider *provider, GdaConnection
 	g_free (dir);
 
         if (! file) {
-                g_set_error (error, 0, 0, _("Missing spec. file '%s'"), str);
+                g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_FILE_NOT_FOUND_ERROR,
+			     _("Missing spec. file '%s'"), str);
 		g_free (str);
                 return NULL;
         }
@@ -916,7 +917,8 @@ gda_oracle_provider_render_operation (GdaServerProvider *provider, GdaConnection
 	g_free (dir);
 
         if (! file) {
-                g_set_error (error, 0, 0, _("Missing spec. file '%s'"), str);
+                g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_FILE_NOT_FOUND_ERROR,
+			     _("Missing spec. file '%s'"), str);
 		g_free (str);
                 return NULL;
         }
diff --git a/providers/postgres/gda-postgres-ddl.c b/providers/postgres/gda-postgres-ddl.c
index d1d0cf1..6ea5612 100644
--- a/providers/postgres/gda-postgres-ddl.c
+++ b/providers/postgres/gda-postgres-ddl.c
@@ -271,7 +271,10 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
 				node = gda_server_operation_get_node_info (op, "/FKEY_S/%d/FKEY_FIELDS_A", i);
 				if (!node || ((nbfields = gda_data_model_get_n_rows (node->model)) == 0)) {
 					allok = FALSE;
-					g_set_error (error, 0, 0, "%s", _("No field specified in foreign key constraint"));
+					g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+						     GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+						     "%s",
+						     _("No field specified in foreign key constraint"));
 				}
 				else {
 					for (j = 0; j < nbfields; j++) {
@@ -285,7 +288,9 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
 						}
 						else {
 							allok = FALSE;
-							g_set_error (error, 0, 0, "%s",  
+							g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+								     GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+								     "%s",  
 								     _("Empty field specified in foreign key constraint"));
 						}
 					}
@@ -300,7 +305,10 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
 				}
 				else {
 					allok = FALSE;
-					g_set_error (error, 0, 0, "%s", _("No referenced table specified in foreign key constraint"));
+					g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+						     GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+						     "%s",
+						     _("No referenced table specified in foreign key constraint"));
 				}
 
 				g_string_append (string, " (");
@@ -315,7 +323,9 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
 					}
 					else {
 						allok = FALSE;
-						g_set_error (error, 0, 0, "%s",  
+						g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+							     GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+							     "%s",  
 							     _("Empty referenced field specified in foreign key constraint"));
 					}
 				}
@@ -362,7 +372,9 @@ gda_postgres_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cn
 
 	if (!hasfields) {
 		allok = FALSE;
-		g_set_error (error, 0, 0, "%s", _("Table to create must have at least one row"));
+		g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+                             GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+			     "%s", _("Table to create must have at least one row"));
 	}
 
 	if (allok) {
diff --git a/providers/skel-implementation/capi/gda-capi-ddl.c b/providers/skel-implementation/capi/gda-capi-ddl.c
index 5d89200..0528fbd 100644
--- a/providers/skel-implementation/capi/gda-capi-ddl.c
+++ b/providers/skel-implementation/capi/gda-capi-ddl.c
@@ -139,7 +139,9 @@ gda_capi_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
 
 	if (!hasfields) {
 		allok = FALSE;
-		g_set_error (error, 0, 0, "%s", _("Table to create must have at least one row"));
+		g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+                             GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+			     "%s", _("Table to create must have at least one row"));
 	}
 
 	return g_string_free (string, FALSE);
diff --git a/providers/skel-implementation/capi/gda-capi-provider.c b/providers/skel-implementation/capi/gda-capi-provider.c
index d7d0cbe..bf1a451 100644
--- a/providers/skel-implementation/capi/gda-capi-provider.c
+++ b/providers/skel-implementation/capi/gda-capi-provider.c
@@ -521,7 +521,8 @@ gda_capi_provider_create_operation (GdaServerProvider *provider, GdaConnection *
 	g_free (dir);
 
         if (! file) {
-                g_set_error (error, 0, 0, _("Missing spec. file '%s'"), str);
+                g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_FILE_NOT_FOUND_ERROR,
+			     _("Missing spec. file '%s'"), str);
 		g_free (str);
                 return NULL;
         }
@@ -560,7 +561,8 @@ gda_capi_provider_render_operation (GdaServerProvider *provider, GdaConnection *
 	g_free (dir);
 
         if (! file) {
-                g_set_error (error, 0, 0, _("Missing spec. file '%s'"), str);
+                g_set_error (error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_FILE_NOT_FOUND_ERROR,
+			     _("Missing spec. file '%s'"), str);
 		g_free (str);
                 return NULL;
         }
diff --git a/providers/web/gda-web-ddl.c b/providers/web/gda-web-ddl.c
index fef475c..350ddbf 100644
--- a/providers/web/gda-web-ddl.c
+++ b/providers/web/gda-web-ddl.c
@@ -136,7 +136,9 @@ gda_web_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
 
 	if (!hasfields) {
 		allok = FALSE;
-		g_set_error (error, 0, 0, "%s", _("Table to create must have at least one row"));
+		g_set_error (error, GDA_SERVER_OPERATION_ERROR,
+                             GDA_SERVER_OPERATION_INCORRECT_VALUE_ERROR,
+			     "%s", _("Table to create must have at least one row"));
 	}
 
 	return g_string_free (string, FALSE);
diff --git a/providers/web/gda-web-provider.c b/providers/web/gda-web-provider.c
index ab28965..584b5de 100644
--- a/providers/web/gda-web-provider.c
+++ b/providers/web/gda-web-provider.c
@@ -625,12 +625,16 @@ gda_web_provider_create_operation (GdaServerProvider *provider, GdaConnection *c
 		cdata = (WebConnectionData*) gda_connection_internal_get_provider_data (cnc);
 	}
 	if (!cdata) {
-		g_set_error (error, 0, 0, _("Not supported"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
+			     "%s", _("Not supported"));
 		return NULL;
 	}
 
 	TO_IMPLEMENT;
-	g_set_error (error, 0, 0, _("Server operations not yet implemented"));
+	g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+		     GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
+		     "%s", _("Server operations not yet implemented"));
 	return NULL;
 }
 
@@ -650,12 +654,16 @@ gda_web_provider_render_operation (GdaServerProvider *provider, GdaConnection *c
 		cdata = (WebConnectionData*) gda_connection_internal_get_provider_data (cnc);
 	}
 	if (!cdata) {
-		g_set_error (error, 0, 0, _("Not supported"));
+		g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
+			     "%s", _("Not supported"));
 		return NULL;
 	}
 
 	TO_IMPLEMENT;
-	g_set_error (error, 0, 0, _("Server operations not yet implemented"));
+	g_set_error (error, GDA_SERVER_PROVIDER_ERROR,
+			     GDA_SERVER_PROVIDER_METHOD_NON_IMPLEMENTED_ERROR,
+		     "%s", _("Server operations not yet implemented"));
 	return NULL;
 }
 
diff --git a/tests/providers/prov-test-common.c b/tests/providers/prov-test-common.c
index 706a1b9..2607813 100644
--- a/tests/providers/prov-test-common.c
+++ b/tests/providers/prov-test-common.c
@@ -53,7 +53,7 @@ prov_test_common_setup ()
 			if (error->domain != 0) {
 				gchar *str = g_strdup_printf ("Could not setup connection: %s", 
 							      error->message ? error->message : "No detail");
-				fail (str);
+				g_warning ("%s", str);
 				g_free (str);
 				number_failed++;
 			}
@@ -68,7 +68,7 @@ prov_test_common_setup ()
 		if (!test_cnc_setup_db_structure (cnc, file, &error)) {
 			gchar *str = g_strdup_printf ("Could not setup database structure: %s", 
 						      error && error->message ? error->message : "No detail");
-			fail (str);
+			g_warning ("%s", str);
 			g_free (str);
 			if (error)
 				g_error_free (error);
diff --git a/tests/providers/prov-test-common.h b/tests/providers/prov-test-common.h
index 2a1c90b..95d4233 100644
--- a/tests/providers/prov-test-common.h
+++ b/tests/providers/prov-test-common.h
@@ -23,10 +23,6 @@
 #include <libgda/libgda.h>
 #include "prov-test-util.h"
 
-#define fail(x) g_warning ("%s", x)
-#define fail_if(x,y) if (x) g_warning ("%s", y)
-#define fail_unless(x,y) if (!(x)) g_warning ("%s", y)
-
 int prov_test_common_setup ();
 int prov_test_common_load_data ();
 int prov_test_common_check_meta ();



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