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



commit 36d5a17d309aa7ab24ef1724c0da1e154f93aea2
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 1f90209..6f581c2 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -1103,8 +1103,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;
@@ -1137,8 +1147,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]