[evolution-data-server] EBookBackendFile: Propagate correct errors.



commit e0719ff46d4fe65f15eaffb1a03176af0f696694
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Tue Feb 26 20:55:28 2013 +0900

    EBookBackendFile: Propagate correct errors.
    
    Propagate the right E_DATA_BOOK_STATUS code in the case that
    E_BOOK_SDB_ERROR_NOT_SUPPORTED is reported from the underlying
    EBookBackendSqliteDB

 addressbook/backends/file/e-book-backend-file.c |   28 +++++++++++++++++++---
 1 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index 4a420df..53ac1be 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -1076,8 +1076,18 @@ e_book_backend_file_get_contact_list (EBookBackendSync *backend,
                g_slist_free (summary_list);
 
        } else if (local_error != NULL) {
-               g_warning ("Failed to fetch contacts: %s", local_error->message);
-               g_propagate_error (perror, local_error);
+
+               if (g_error_matches (local_error,
+                                    E_BOOK_SDB_ERROR,
+                                    E_BOOK_SDB_ERROR_NOT_SUPPORTED)) {
+                       g_set_error (perror, E_DATA_BOOK_ERROR,
+                                    E_DATA_BOOK_STATUS_NOT_SUPPORTED,
+                                    _("Query '%s' not supported"), query);
+                       g_error_free (local_error);
+               } else {
+                       g_warning ("Failed to fetch contact ids: %s", local_error->message);
+                       g_propagate_error (perror, local_error);
+               }
        }
 
        *contacts = contact_list;
@@ -1105,8 +1115,18 @@ e_book_backend_file_get_contact_list_uids (EBookBackendSync *backend,
        g_rw_lock_reader_unlock (&(bf->priv->lock));
 
        if (uids == NULL && local_error != NULL) {
-               g_warning ("Failed to fetch contact ids: %s", local_error->message);
-               g_propagate_error (perror, local_error);
+
+               if (g_error_matches (local_error,
+                                    E_BOOK_SDB_ERROR,
+                                    E_BOOK_SDB_ERROR_NOT_SUPPORTED)) {
+                       g_set_error (perror, E_DATA_BOOK_ERROR,
+                                    E_DATA_BOOK_STATUS_NOT_SUPPORTED,
+                                    _("Query '%s' not supported"), query);
+                       g_error_free (local_error);
+               } else {
+                       g_warning ("Failed to fetch contact ids: %s", local_error->message);
+                       g_propagate_error (perror, local_error);
+               }
        }
 
        *contacts_uids = g_slist_reverse (uids);


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