[evolution-data-server] EBookBackendFile: Report the correct error from remove_contacts()



commit 4cbd466c71012968d998b06c1a13c959340d18c2
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Fri Feb 22 18:33:07 2013 +0900

    EBookBackendFile: Report the correct error from remove_contacts()
    
    If the EBookBackenSqliteDB reports CONTACT_NOT_FOUND, then use
    E_DATA_BOOK_STATUS_CONTACT_NOT_FOUND, this causes test-client-remove-contact
    to pass again.
    
    See bug: https://bugzilla.gnome.org/show_bug.cgi?id=694188

 addressbook/backends/file/e-book-backend-file.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index 2e4d409..4a420df 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -834,7 +834,16 @@ e_book_backend_file_remove_contacts (EBookBackendSync *backend,
                        removed_contacts = g_slist_prepend (removed_contacts, contact);
                } else {
                        g_warning ("Failed to fetch contact to be removed: %s", local_error->message);
-                       g_propagate_error (perror, local_error);
+
+                       if (g_error_matches (local_error,
+                                            E_BOOK_SDB_ERROR,
+                                            E_BOOK_SDB_ERROR_CONTACT_NOT_FOUND)) {
+                               g_set_error (perror, E_DATA_BOOK_ERROR,
+                                            E_DATA_BOOK_STATUS_CONTACT_NOT_FOUND,
+                                            _("Contact '%s' not found"), id);
+                               g_error_free (local_error);
+                       } else
+                               g_propagate_error (perror, local_error);
 
                        /* Abort as soon as missing contact is to be deleted */
                        delete_failed = TRUE;


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