EBookBackendFile: Report the correct error from remove_contacts()
authorTristan Van Berkom <tristanvb@openismus.com>
Fri, 22 Feb 2013 09:33:07 +0000 (18:33 +0900)
committerTristan Van Berkom <tristanvb@openismus.com>
Fri, 22 Feb 2013 09:46:40 +0000 (18:46 +0900)
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

index 2e4d409..4a420df 100644 (file)
@@ -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;