[libvirt] [PATCH 03/10] util: error: Add error message versions with info for some error codes

Peter Krempa posted 10 patches 7 years, 2 months ago
[libvirt] [PATCH 03/10] util: error: Add error message versions with info for some error codes
Posted by Peter Krempa 7 years, 2 months ago
Few error codes were missing the version of the message with additional
info. In case of the modified messages it's not very likely they'll ever
report any additional data, but for the sake of consistency we'll
provide them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/util/virerror.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/util/virerror.c b/src/util/virerror.c
index 5d515bde57..64be00dc75 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -926,7 +926,10 @@ virErrorMsg(virErrorNumber error, const char *info)
               errmsg = _("internal error");
             break;
         case VIR_ERR_NO_MEMORY:
-            errmsg = _("out of memory");
+            if (info == NULL)
+                errmsg = _("out of memory");
+            else
+                errmsg = _("out of memory: %s");
             break;
         case VIR_ERR_NO_SUPPORT:
             if (info == NULL)
@@ -1019,7 +1022,10 @@ virErrorMsg(virErrorNumber error, const char *info)
                 errmsg = _("unknown OS type %s");
             break;
         case VIR_ERR_NO_KERNEL:
-            errmsg = _("missing kernel information");
+            if (info == NULL)
+                errmsg = _("missing kernel information");
+            else
+                errmsg = _("missing kernel information: %s");
             break;
         case VIR_ERR_NO_ROOT:
             if (info == NULL)
@@ -1472,7 +1478,10 @@ virErrorMsg(virErrorNumber error, const char *info)
                 errmsg = _("XML document failed to validate against schema: %s");
             break;
         case VIR_ERR_MIGRATE_FINISH_OK:
-            errmsg = _("migration successfully aborted");
+            if (info == NULL)
+                errmsg = _("migration successfully aborted");
+            else
+                errmsg = _("migration successfully aborted: %s");
             break;
         case VIR_ERR_NO_SERVER:
             if (info == NULL)
-- 
2.19.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 03/10] util: error: Add error message versions with info for some error codes
Posted by Erik Skultety 7 years, 2 months ago
On Wed, Dec 05, 2018 at 05:47:44PM +0100, Peter Krempa wrote:
> Few error codes were missing the version of the message with additional

s/lacking a/missing the

> info. In case of the modified messages it's not very likely they'll ever
> report any additional data, but for the sake of consistency we'll
> provide them.

s/we'll/we should

Reviewed-by: Erik Skultety <eskultet@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list