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

[libvirt] [libvirt-glib 3/3] Replace g_error with g_warning in constructors



g_error generates a fatal error message, meaning it will abort
the currently running process. It's nicer to use g_warning here.
---
 libvirt-gobject/libvirt-gobject-domain.c         |    4 +++-
 libvirt-gobject/libvirt-gobject-network-filter.c |    4 +++-
 libvirt-gobject/libvirt-gobject-network.c        |    4 +++-
 libvirt-gobject/libvirt-gobject-secret.c         |    4 +++-
 libvirt-gobject/libvirt-gobject-storage-pool.c   |    4 +++-
 5 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index dc3f55e..691e29b 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -134,7 +134,9 @@ static void gvir_domain_constructed(GObject *object)
 
     /* xxx we may want to turn this into an initable */
     if (virDomainGetUUIDString(priv->handle, priv->uuid) < 0) {
-        g_error("Failed to get domain UUID on %p", priv->handle);
+        virErrorPtr verr = virGetLastError();
+        g_warning("Failed to get domain UUID on %p: %s",
+                  priv->handle, verr->message);
     }
 }
 
diff --git a/libvirt-gobject/libvirt-gobject-network-filter.c b/libvirt-gobject/libvirt-gobject-network-filter.c
index c0a6a2b..3760844 100644
--- a/libvirt-gobject/libvirt-gobject-network-filter.c
+++ b/libvirt-gobject/libvirt-gobject-network-filter.c
@@ -119,7 +119,9 @@ static void gvir_network_filter_constructed(GObject *object)
 
     /* xxx we may want to turn this into an initable */
     if (virNWFilterGetUUIDString(priv->handle, priv->uuid) < 0) {
-        g_error("Failed to get network filter UUID on %p", priv->handle);
+        virErrorPtr verr = virGetLastError();
+        g_warning("Failed to get network filter UUID on %p: %s",
+                  priv->handle, verr->message);
     }
 }
 
diff --git a/libvirt-gobject/libvirt-gobject-network.c b/libvirt-gobject/libvirt-gobject-network.c
index 36f9a00..bfc867c 100644
--- a/libvirt-gobject/libvirt-gobject-network.c
+++ b/libvirt-gobject/libvirt-gobject-network.c
@@ -118,7 +118,9 @@ static void gvir_network_constructed(GObject *object)
 
     /* xxx we may want to turn this into an initable */
     if (virNetworkGetUUIDString(priv->handle, priv->uuid) < 0) {
-        g_error("Failed to get network UUID on %p", priv->handle);
+        virErrorPtr verr = virGetLastError();
+        g_warning("Failed to get network UUID on %p: %s",
+                  priv->handle, verr->message);
     }
 }
 
diff --git a/libvirt-gobject/libvirt-gobject-secret.c b/libvirt-gobject/libvirt-gobject-secret.c
index 0c81921..8546a0c 100644
--- a/libvirt-gobject/libvirt-gobject-secret.c
+++ b/libvirt-gobject/libvirt-gobject-secret.c
@@ -119,7 +119,9 @@ static void gvir_secret_constructed(GObject *object)
 
     /* xxx we may want to turn this into an initable */
     if (virSecretGetUUIDString(priv->handle, priv->uuid) < 0) {
-        g_error("Failed to get secret UUID on %p", priv->handle);
+        virErrorPtr verr = virGetLastError();
+        g_warning("Failed to get secret UUID on %p: %s",
+                  priv->handle, verr->message);
     }
 }
 
diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
index f0b801e..fd0f0dd 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.c
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
@@ -129,7 +129,9 @@ static void gvir_storage_pool_constructed(GObject *object)
 
     /* xxx we may want to turn this into an initable */
     if (virStoragePoolGetUUIDString(priv->handle, priv->uuid) < 0) {
-        g_error("Failed to get storage pool UUID on %p", priv->handle);
+        virErrorPtr verr = virGetLastError();
+        g_warning("Failed to get storage pool UUID on %p: %s",
+                  priv->handle, verr->message);
     }
 }
 
-- 
1.7.7.5


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