[libgda] providers: improve error reporting



commit bd63b6a1882fe67c425ff1f81b7660e2e735935e
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date:   Mon Dec 24 18:55:50 2018 -0600

    providers: improve error reporting

 libgda/gda-connection.c      |  4 ++++
 libgda/gda-server-provider.c | 26 ++++++++++----------------
 2 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index c7985ac9c..8060cd428 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -4082,6 +4082,7 @@ check_parameters (GdaMetaContext *context, GError **error, gint nb, ...)
                             _("Missing or wrong arguments for table '%s': %s"),
                             context->table_name, str);
                g_free (str);
+               retval = -1;
        }
 
        /*g_print ("Check arguments context => found %d\n", retval);*/
@@ -4293,6 +4294,9 @@ local_meta_update (GdaServerProvider *provider, GdaConnection *cnc, GdaMetaConte
                        i = check_parameters (context, error, 1,
                                              &name, G_TYPE_STRING, NULL,
                                              "specific_name", &name, NULL);
+                       if (error && *error) {
+                               return FALSE;
+                       }
                        ASSERT_TABLE_NAME (tname, "element_types");
                        if (i < 0) {
                                retval = _gda_server_provider_meta_0arg (provider, cnc, store, context,
diff --git a/libgda/gda-server-provider.c b/libgda/gda-server-provider.c
index faec60a9b..e4f58fabf 100644
--- a/libgda/gda-server-provider.c
+++ b/libgda/gda-server-provider.c
@@ -2891,25 +2891,19 @@ static gboolean
 meta_finalize_result (gpointer retval, GError **call_error, GError **loc_error)
 {
        if (retval) {
-               if (loc_error)
-                       g_clear_error (loc_error);
+               g_clear_error (loc_error);
                return TRUE;
        }
-       else {
-               if (loc_error && *loc_error && (*loc_error)->message)
-                       g_set_error (call_error, GDA_SERVER_PROVIDER_ERROR, 
GDA_SERVER_PROVIDER_INTERNAL_ERROR,
-                                    _("Internal error please report bug to "
-                                      "https://gitlab.gnome.org/GNOME/libgda/issues "
-                                      "Reported error is: %s"),
-                                    (*loc_error)->message);
-               else
-                       g_set_error (call_error, GDA_SERVER_PROVIDER_ERROR, 
GDA_SERVER_PROVIDER_INTERNAL_ERROR,
-                                    _("Internal error please report bug to "
-                                      "https://gitlab.gnome.org/GNOME/libgda/issues";));
-               if (loc_error)
-                       g_clear_error (loc_error);
-               return FALSE;
+       if (loc_error && *loc_error && (*loc_error)->message) {
+               g_set_error (call_error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+                            _("Internal error please report bug to 
https://gitlab.gnome.org/GNOME/libgda/issues Reported error is: %s"),
+                            (*loc_error)->message);
+  } else {
+               g_set_error (call_error, GDA_SERVER_PROVIDER_ERROR, GDA_SERVER_PROVIDER_INTERNAL_ERROR,
+                            _("Internal error please report bug to 
https://gitlab.gnome.org/GNOME/libgda/issues";));
        }
+       g_clear_error (loc_error);
+       return FALSE;
 }
 
 gboolean


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