qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	peter.maydell@linaro.org, qemu-devel@nongnu.org,
	armbru@redhat.com, pbonzini@redhat.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [RFC 00/14]: add printf-like human msg to error_set()
Date: Thu, 26 Jul 2012 11:12:29 -0300	[thread overview]
Message-ID: <20120726111229.22e5a71e@doriath.home> (raw)
In-Reply-To: <87fw8eofto.fsf@codemonkey.ws>

On Thu, 26 Jul 2012 07:41:07 -0500
Anthony Liguori <aliguori@us.ibm.com> wrote:

> Kevin Wolf <kwolf@redhat.com> writes:
> 
> > Am 26.07.2012 04:43, schrieb Anthony Liguori:
> >> Luiz Capitulino <lcapitulino@redhat.com> writes:
> >> 
> >>> Basically, this series changes a call like:
> >>>
> >>>  error_set(errp, QERR_DEVICE_NOT_FOUND, device);
> >>>
> >>> to:
> >>>
> >>>  error_set(errp, QERR_DEVICE_NOT_FOUND,
> >>>            "Device 'device=%s' not found", device);
> >>>
> >>> In the first call, QERR_DEVICE_NOT_FOUND is a string containing a json dict:
> >>>
> >>>     "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
> >> 
> >> This is the wrong direction.  Looking through the patch, this makes the
> >> code much more redundant overall.  You have dozens of calls that are
> >> duplicating the same error message.  This is not progress.
> >
> > I believe this is mostly because it's a mechanical conversion. Once this
> > is done, we can change error messages to better fit the individual
> > cases.

Correct.

> 
> We don't gain anything by touching every user of error and the code gets
> more verbose. 

We do gain the possibility to have better and different human messages for the
same error class. That's impossible today. And creating a different error class
just to have a different error message is just crazy (which is what we do
today, btw).

Now, if the problem you see is that we shouldn't touch current users but
add a new function for new users to use (or change old users incrementally, when
it matters), then we can discuss that.

> If we want to modify an existing error for some good
> reason, we can do so my changing error types.

You mean, creating a new error class just to have a different human message?
We have 70+ classes today, how many will we have in another year?

> 
> >> We should just stick with a simple QERR_GENERIC and call it a day.
> >> Let's not needlessly complicate existing code.
> >
> > Why even have error codes when everything should become QERR_GENERIC? Or
> > am I misunderstanding?
> 
> If we want to add an error code, we can do:
> 
>    error_set(QERR_GENERIC, "domain", "My free form text")
> 
> And then yes, we can change this to:
> 
>    error_setf(errp, "domain", "My free form text")

Would domain be the error classes we have today?

If error_setf() ends result is similar to what this series does with
error_set(), then that might be acceptable, although I fear we keep
adding new ways to report errors.

  reply	other threads:[~2012-07-26 14:12 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25 20:50 [Qemu-devel] [RFC 00/14]: add printf-like human msg to error_set() Luiz Capitulino
2012-07-25 20:50 ` [Qemu-devel] [PATCH 01/14] monitor: drop unused monitor debug code Luiz Capitulino
2012-07-25 20:50 ` [Qemu-devel] [PATCH 02/14] qerror: reduce public exposure Luiz Capitulino
2012-07-25 20:50 ` [Qemu-devel] [PATCH 03/14] qerror: drop qerror_abort() Luiz Capitulino
2012-07-26 12:33   ` Markus Armbruster
2012-07-26 15:02     ` Luiz Capitulino
2012-07-26 12:59   ` Eric Blake
2012-07-25 20:50 ` [Qemu-devel] [PATCH 04/14] qerror: drop qerror_report_internal() Luiz Capitulino
2012-07-26 12:35   ` Markus Armbruster
2012-07-25 20:50 ` [Qemu-devel] [PATCH 05/14] qerror: qerror_format(): return an allocated string Luiz Capitulino
2012-07-25 20:50 ` [Qemu-devel] [PATCH 06/14] qerror: don't delay error message construction Luiz Capitulino
2012-07-25 20:50 ` [Qemu-devel] [PATCH 07/14] error: " Luiz Capitulino
2012-07-25 20:50 ` [Qemu-devel] [PATCH 08/14] qerror: add build_error_dict() and error_object_table[] Luiz Capitulino
2012-07-26 12:52   ` Markus Armbruster
2012-07-25 20:50 ` [Qemu-devel] [PATCH 09/14] qerror: qerror_report(): take an index and a human error message Luiz Capitulino
2012-07-25 20:50 ` [Qemu-devel] [PATCH 10/14] error: error_set(): " Luiz Capitulino
2012-07-25 20:50 ` [Qemu-devel] [PATCH 11/14] qerror: drop qerror_table[] for good Luiz Capitulino
2012-07-26 12:54   ` Markus Armbruster
2012-07-25 20:50 ` [Qemu-devel] [PATCH 12/14] error: turn QERR_ macros into an enumeration Luiz Capitulino
2012-07-25 20:50 ` [Qemu-devel] [PATCH 13/14] qerror: change all qerror_report() calls to use the ErrClass enum Luiz Capitulino
2012-07-25 20:50 ` [Qemu-devel] [PATCH 14/14] error: change all error_set() " Luiz Capitulino
2012-07-26  2:43 ` [Qemu-devel] [RFC 00/14]: add printf-like human msg to error_set() Anthony Liguori
2012-07-26  9:45   ` Kevin Wolf
2012-07-26 12:41     ` Anthony Liguori
2012-07-26 14:12       ` Luiz Capitulino [this message]
2012-07-26 15:05         ` Anthony Liguori
2012-07-26 15:52           ` Markus Armbruster
2012-07-26 14:40       ` Kevin Wolf
2012-07-26 15:20         ` Anthony Liguori
2012-07-26 16:12   ` Daniel P. Berrange
2012-07-26 16:38     ` Markus Armbruster
2012-07-26 15:54 ` Markus Armbruster
2012-07-26 16:03   ` Paolo Bonzini
2012-07-26 16:37     ` Luiz Capitulino
2012-07-27 13:17       ` Andreas Färber
2012-07-27 13:45         ` Anthony Liguori
2012-07-27 14:27         ` Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120726111229.22e5a71e@doriath.home \
    --to=lcapitulino@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).