telepathy-mission-control: McdStorage: adjust IdentifyAccount error behaviour

Simon McVittie smcv at kemper.freedesktop.org
Thu Jan 30 04:34:40 PST 2014


Module: telepathy-mission-control
Branch: master
Commit: 657b61379825143b83465c840e1fa70a66d3989f
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=657b61379825143b83465c840e1fa70a66d3989f

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Wed Nov 13 17:40:19 2013 +0000

McdStorage: adjust IdentifyAccount error behaviour

We were ignoring failures if they were NotImplemented or ServiceUnknown,
but thinking about it more, we should probably ignore "most" errors
here: the only errors that should abort the account-creation attempt
are those that indicate that the intended parameters are unusable,
namely InvalidArgument and InvalidHandle (in its secondary role as
"invalid identifier-that-corresponds-to-a-handle").

Also add more debug messages here.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=27727

---

 src/mcd-storage.c |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/mcd-storage.c b/src/mcd-storage.c
index b3a4bc9..37d6700 100644
--- a/src/mcd-storage.c
+++ b/src/mcd-storage.c
@@ -469,17 +469,26 @@ identify_account_cb (TpProxy *proxy,
 {
   if (error == NULL)
     {
+      DEBUG ("identified account: %s", identification);
       g_task_return_pointer (task, g_strdup (identification), g_free);
     }
-  else if (g_error_matches (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED) ||
-      g_error_matches (error, DBUS_GERROR, DBUS_GERROR_SERVICE_UNKNOWN))
+  else if (g_error_matches (error, TP_ERROR, TP_ERROR_INVALID_HANDLE) ||
+      g_error_matches (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT))
     {
-      g_task_return_pointer (task, g_strdup (g_task_get_task_data (task)),
-          g_free);
+      /* The connection manager didn't like our account parameters.
+       * Give up now. */
+      DEBUG ("failed to identify account: %s #%d: %s",
+          g_quark_to_string (error->domain), error->code, error->message);
+      g_task_return_error (task, g_error_copy (error));
     }
   else
     {
-      g_task_return_error (task, g_error_copy (error));
+      /* We weren't able to identify the account, but carry on and hope
+       * for the best... */
+      DEBUG ("ignoring failure to identify account: %s #%d: %s",
+          g_quark_to_string (error->domain), error->code, error->message);
+      g_task_return_pointer (task, g_strdup (g_task_get_task_data (task)),
+          g_free);
     }
 }
 



More information about the telepathy-commits mailing list