[libvirt] [PATCH 08/10] util: error: Use a more declarative approach in virErrorMsg

Peter Krempa pkrempa at redhat.com
Thu Dec 6 11:35:15 UTC 2018


On Thu, Dec 06, 2018 at 12:29:27 +0100, Erik Skultety wrote:
> On Wed, Dec 05, 2018 at 05:47:49PM +0100, Peter Krempa wrote:
> > Use a macro to declare how the strings for individual error codes. This
> > unifies the used condition and will allow simplifying the code further.
> >
> > Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> > ---
> >  src/libvirt_private.syms |   1 +
> >  src/util/virerror.c      | 792 +++++++++------------------------------
> >  src/util/virerrorpriv.h  |   8 +
> >  3 files changed, 188 insertions(+), 613 deletions(-)
> >

[..]

> > diff --git a/src/util/virerror.c b/src/util/virerror.c
> > index 7444d671bb..d3cd06331f 100644
> > --- a/src/util/virerror.c
> > +++ b/src/util/virerror.c
> > @@ -903,6 +903,178 @@ void virRaiseErrorObject(const char *filename,
[...]

> > +    { VIR_ERR_UNKNOWN_HOST, "unknown host", "unknown host %s" },
> > +    { VIR_ERR_NO_CONNECT,
> > +        "no connection driver available",
> > +        "no connection driver available for %s" },
> > +    { VIR_ERR_INVALID_CONN, "invalid connection pointer in", "invalid connection pointer in %s" },
> > +    { VIR_ERR_INVALID_DOMAIN, "invalid domain pointer in", "invalid domain pointer in %s" },
> 
> Most of the messages exceed the 80 chars limit, I think it's reasonable to play
> the consistency card (+ personally I find it more readable too) and say that
> every member should be on a separate line.

I was shooting for < 100 colums for these in this case. 80 is getting
ridiculous in some cases. Honestly I'd prefer them all on one line
rather than broken up.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20181206/ee54e173/attachment-0001.sig>


More information about the libvir-list mailing list