[libvirt] [PATCH 02/10] util: error: Fix error message strings to play well with additional info

Peter Krempa posted 10 patches 7 years, 2 months ago
[libvirt] [PATCH 02/10] util: error: Fix error message strings to play well with additional info
Posted by Peter Krempa 7 years, 2 months ago
Additional information for a string is always in form of a string or
empty. Fix two offenders. One used %d as format modifier and second
always expected a string. Both are thankfully unused currently.

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

diff --git a/src/util/virerror.c b/src/util/virerror.c
index eca6ddf7d1..5d515bde57 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -977,7 +977,10 @@ virErrorMsg(virErrorNumber error, const char *info)
                 errmsg = _("POST operation failed");
             break;
         case VIR_ERR_HTTP_ERROR:
-            errmsg = _("got unknown HTTP error code %d");
+            if (info != NULL)
+                errmsg = _("got unknown HTTP error code %s");
+            else
+                errmsg = _("got unknown HTTP error code");
             break;
         case VIR_ERR_UNKNOWN_HOST:
             if (info != NULL)
@@ -1004,7 +1007,10 @@ virErrorMsg(virErrorNumber error, const char *info)
                 errmsg = _("could not connect to Xen Store %s");
             break;
         case VIR_ERR_XEN_CALL:
-            errmsg = _("failed Xen syscall %s");
+            if (info == NULL)
+                errmsg = _("failed Xen syscall");
+            else
+                errmsg = _("failed Xen syscall %s");
             break;
         case VIR_ERR_OS_TYPE:
             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 02/10] util: error: Fix error message strings to play well with additional info
Posted by Erik Skultety 7 years, 2 months ago
On Wed, Dec 05, 2018 at 05:47:43PM +0100, Peter Krempa wrote:
> Additional information for a string is always in form of a string or
> empty. Fix two offenders. One used %d as format modifier and second
> always expected a string. Both are thankfully unused currently.
>
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
Reviewed-by: Erik Skultety <eskultet@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 02/10] util: error: Fix error message strings to play well with additional info
Posted by Erik Skultety 7 years, 2 months ago
On Thu, Dec 06, 2018 at 08:56:59AM +0100, Erik Skultety wrote:
> On Wed, Dec 05, 2018 at 05:47:43PM +0100, Peter Krempa wrote:
> > Additional information for a string is always in form of a string or

s/for a string/for an error message
s/always/either

> > empty. Fix two offenders. One used %d as format modifier and second

s/as /as the
s/ second/the second one

> > always expected a string. Both are thankfully unused currently.

Doesn't sound 100% right...how about:
"Thankfully, neither of the offenders are currently in effect."

> >
> > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> > ---
> Reviewed-by: Erik Skultety <eskultet@redhat.com>

^^This still stands though, it's just the commit message activated the
"grammar <noun_placeholder>" in me for some reason :P, sorry.

Erik

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