]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
xenapi: Improve error reporting in xenapiOpen
authorMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 14 Jul 2011 14:58:43 +0000 (16:58 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 14 Jul 2011 15:51:21 +0000 (17:51 +0200)
Use better suited error code and avoid NULL in error messsage
as *privP->session->error_description can be NULL.

src/xenapi/xenapi_driver.c

index aa616cab2b02dcbacbf63314ec4751567f508f43..98838e69ee28636b1cc368fdf31532b1cb8193d0 100644 (file)
@@ -106,7 +106,7 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth,
     }
 
     if (conn->uri->server == NULL) {
-        xenapiSessionErrorHandler(conn, VIR_ERR_AUTH_FAILED,
+        xenapiSessionErrorHandler(conn, VIR_ERR_INVALID_ARG,
                                   _("Server name not in URI"));
         goto error;
     }
@@ -194,7 +194,9 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth,
     }
 
     xenapiSessionErrorHandler(conn, VIR_ERR_AUTH_FAILED,
-                              *privP->session->error_description);
+                              *privP->session->error_description != NULL ?
+                              *privP->session->error_description :
+                              _("unknown error"));
 
   error:
     VIR_FREE(username);