From a39df9618e5f138638c4729f9f8d53e113023823 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 13 Nov 2013 17:40:19 +0000 Subject: [PATCH 12/26] 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. --- 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); } } -- 1.8.4.3