Bug 29385

Summary: Add smarter TpAccount API to get the connection error
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED MOVED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: enhancement    
Priority: low    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Guillaume Desmottes 2010-08-03 08:59:56 UTC
<smcv> cassidy: if you have no idea what the D-Bus error means, you want to interpret the reason
<smcv> cassidy: e.g. ("com.nokia.Hovercraft.FullOfEels", CSR_AUTHENTICATION_FAILED) should come out as "Authentication failed" not as whatever your default is
<smcv> cassidy: (which is presumably *still* NetworkError :-P )
<smcv> cassidy: what you probably *actually* want is for TpAccount to grow logic analogous to tp_connection_status_changed_cb
<smcv> cassidy: so it gives you a GError in a domain you've registered as an extension, or in TP_ERRORS (based on the reason code) if the D-Bus error isn't in a domain that you can be expected to understand
Comment 1 Simon McVittie 2012-05-04 11:22:34 UTC
You can now sort of do this, by combining these:

TpConnectionStatus tp_account_get_connection_status (TpAccount *account,
    TpConnectionStatusReason *reason);
gchar *tp_account_dup_detailed_error_vardict (TpAccount *self,
    GVariant **details);

but that doesn't do the GError mapping. Lower severity, at least, though.

If we add one, we should give these a similar treatment:

TpConnectionStatus tp_connection_get_status (TpConnection *self,
    TpConnectionStatusReason *reason);
gchar *tp_connection_dup_detailed_error_vardict (TpConnection *self,
    GVariant **details) G_GNUC_WARN_UNUSED_RESULT;

It might even be nice to have something more like this:

    /* returns TRUE if still extant, FALSE if invalidated */
    gboolean tp_proxy_check_error (gpointer, GError **);

    /* returns TRUE if connecting or connected, FALSE with error
       if disconnected */
    gboolean tp_account_check_connection_error (TpAccount *, GError **);

so you can do this in g-i languages:

    try:
        account.check_connection_error()
    except Exception as e:
        print(e)

    try:
        connection.check_error()
    except Exception as e:
        print(e)
Comment 2 GitLab Migration User 2019-12-03 20:03:21 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/telepathy/telepathy-glib/issues/38.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.