[gnome-online-accounts/wip/rishi/kerberos-identity-renew-errors-remove-redundancy-and-null: 1/2] kerberos-identity: Clarify and remove redundancy from the renewal errors




commit 74e31cabb979d6c1d4c85807c8991a6c433a0d82
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Oct 13 18:46:46 2022 +0200

    kerberos-identity: Clarify and remove redundancy from the renewal errors
    
    The "Could not renew identity" segment in the error strings from
    goa_kerberos_identity_renew is redundant because the caller already
    knows that this function is about renewing an identity and any failure
    means just that.  In fact, it's callers in GoaIdentityService and
    GoaKerberosIdentityManager already prepend a similar segment when using
    the error strings.
    
    Debug logs are already verbose enough.  It's better not to make it even
    more difficult to follow them through needless redundancy.
    
    When reporting errors from krb5_cc_get_principal, it's good to make the
    error string match the documentation [1] of that function because it
    makes the code self-documenting.
    
    [1] https://web.mit.edu/kerberos/krb5-devel/doc/appdev/refs/api/krb5_cc_get_principal.html
    
    https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/issues/160

 src/goaidentity/goakerberosidentity.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/goaidentity/goakerberosidentity.c b/src/goaidentity/goakerberosidentity.c
index 45d54f4d..3d2fe25c 100644
--- a/src/goaidentity/goakerberosidentity.c
+++ b/src/goaidentity/goakerberosidentity.c
@@ -1430,7 +1430,7 @@ goa_kerberos_identity_renew (GoaKerberosIdentity *self, GError **error)
       g_set_error (error,
                    GOA_IDENTITY_ERROR,
                    GOA_IDENTITY_ERROR_CREDENTIALS_UNAVAILABLE,
-                   _("Could not renew identity: Not signed in"));
+                   _("Not signed in"));
       goto out;
     }
 
@@ -1440,7 +1440,8 @@ goa_kerberos_identity_renew (GoaKerberosIdentity *self, GError **error)
       set_and_prefix_error_from_krb5_error_code (self,
                                                  error,
                                                  GOA_IDENTITY_ERROR_CREDENTIALS_UNAVAILABLE,
-                                                 error_code, _("Could not renew identity: "));
+                                                 error_code,
+                                                 _("Could not get the default principal: "));
       goto out;
     }
 


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