[folks] TpfPersonaStore: throw PersonaStoreError if an error occure while removing the contact



commit a08aaa04fc305873eee728102b1edfa6f04ef390
Author: Xavier Claessens <xavier claessens collabora co uk>
Date:   Tue Apr 10 17:04:07 2012 +0200

    TpfPersonaStore: throw PersonaStoreError if an error occure while removing the contact
    
    https://bugzilla.gnome.org/show_bug.cgi?id=630822

 backends/telepathy/lib/tpf-persona-store.vala |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index 1410cc9..7625cbb 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -1073,6 +1073,13 @@ public class Tpf.PersonaStore : Folks.PersonaStore
     {
       var tp_persona = (Tpf.Persona) persona;
 
+      if (tp_persona.contact == null)
+        {
+          warning ("Skipping server-side removal of Tpf.Persona %p because " +
+              "it has no attached TpContact", tp_persona);
+          return;
+        }
+
       if (persona == this._self_persona &&
           tp_persona.is_in_contact_list == false)
         {
@@ -1080,14 +1087,16 @@ public class Tpf.PersonaStore : Folks.PersonaStore
               _("Telepathy contacts representing the local user may not be removed."));
         }
 
-      if (tp_persona.contact == null)
+      try
         {
-          warning ("Skipping server-side removal of Tpf.Persona %p because " +
-              "it has no attached TpContact", tp_persona);
-          return;
+          yield tp_persona.contact.remove_async ();
+        }
+      catch (GLib.Error e)
+        {
+          /* Translators: the parameter is an error message. */
+          throw new PersonaStoreError.REMOVE_FAILED (
+              _("Failed to remove a persona from store: %s"), e.message);
         }
-
-      tp_persona.contact.remove_async ();
     }
 
   private async Persona _ensure_persona_for_id (string contact_id)



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