EBookBackendSqliteDB: Added contact-not-found error type.
authorTristan Van Berkom <tristanvb@openismus.com>
Mon, 21 Jan 2013 08:50:55 +0000 (17:50 +0900)
committerTristan Van Berkom <tristanvb@openismus.com>
Wed, 23 Jan 2013 04:38:13 +0000 (13:38 +0900)
Report this error if a contact was requested by UID and not found.

addressbook/libedata-book/e-book-backend-sqlitedb.c
addressbook/libedata-book/e-book-backend-sqlitedb.h

index 5df68c3..1382de6 100644 (file)
@@ -2130,10 +2130,9 @@ e_book_backend_sqlitedb_get_vcard_string (EBookBackendSqliteDB *ebsdb,
        if (with_all_required_fields)
                *with_all_required_fields = local_with_all_required_fields;
 
-       /* Is is an error to not find a contact ?? */
        if (!vcard_str && error && !*error)
                g_set_error (
-                       error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_OTHER,
+                       error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_CONTACT_NOT_FOUND,
                        _("Contact '%s' not found"), uid ? uid : "NULL");
 
        return vcard_str;
index c5621af..cfc33e6 100644 (file)
@@ -65,12 +65,15 @@ typedef struct _EBookBackendSqliteDBPrivate EBookBackendSqliteDBPrivate;
 /**
  * EBookSDBError:
  * @E_BOOK_SDB_ERROR_CONSTRAINT: The error occurred due to an explicit constraint
+ * @E_BOOK_SDB_ERROR_CONTACT_NOT_FOUND: A contact was not found by UID (this is different
+ *                                      from a query that returns no results, which is not an error).
  * @E_BOOK_SDB_ERROR_OTHER: Another error occurred
  *
  * Defines the types of possible errors reported by the #EBookBackendSqliteDB
  */
 typedef enum {
        E_BOOK_SDB_ERROR_CONSTRAINT,
+       E_BOOK_SDB_ERROR_CONTACT_NOT_FOUND,
        E_BOOK_SDB_ERROR_OTHER
 } EBookSDBError;