[virt-tools-list] [PATCH 2/2] Improve authentication error messages

Christophe Fergeau cfergeau at redhat.com
Tue Sep 23 14:57:37 UTC 2014


On Tue, Sep 23, 2014 at 04:46:15PM +0200, Fabiano Fidêncio wrote:
> Adding the libvirt error message to our default error message.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1142742
> ---
>  src/virt-viewer.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/virt-viewer.c b/src/virt-viewer.c
> index 3d5a363..513c0b6 100644
> --- a/src/virt-viewer.c
> +++ b/src/virt-viewer.c
> @@ -698,8 +698,10 @@ virt_viewer_connect(VirtViewerApp *app)
>                                      oflags);
>      if (!priv->conn) {
>          if (!priv->auth_cancelled) {
> -            virt_viewer_app_simple_message_dialog(app, _("Unable to connect to libvirt with URI %s"),
> -                                                  priv->uri ? priv->uri : _("[none]"));
> +            const gchar *error_message = virGetLastErrorMessage();
> +
> +            virt_viewer_app_simple_message_dialog(app, _("Unable to connect to libvirt with URI %s.\nError: '%s'."),
> +                                                  priv->uri ? priv->uri : _("[none]"), error_message);

Concatenating error messages from underlying libraries to some generic
error message generally leads to something suboptimal UI-wise. I'd tend
to special case situations when we want a different error message, and
to have some g_debug output withthe detailed error message if this does
not exist yet.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20140923/0e62bf28/attachment.sig>


More information about the virt-tools-list mailing list