All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Subject: Re: Questionable aspects of QEMU Error's design
Date: Wed, 01 Apr 2020 17:05:40 +0200	[thread overview]
Message-ID: <87h7y3fdq3.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <e980477d-3951-2a2b-fa38-dee8e1895019@virtuozzo.com> (Vladimir Sementsov-Ogievskiy's message of "Wed, 1 Apr 2020 15:10:05 +0300")

Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> writes:

> Side question:
>
> Can we somehow implement a possibility to reliably identify file and line number
> where error is set by error message?
>
> It's where debug of error-bugs always starts: try to imagine which parts of the error
> message are "%s", and how to grep for it in the code, keeping in mind also,
> that error massage may be split into several lines..
>
> Put file:line into each error? Seems too noisy for users.. A lot of errors are not
> bugs: use do something wrong and see the error, and understands what he is doing
> wrong.. It's not usual practice to print file:line into each message for user.
>
>
> But what if we do some kind of mapping file:line <-> error code, so user will see
> something like:
>
>
>    Error 12345: Device drive-scsi0-0-0-0 is not found
>
> ....
>
> Hmm, maybe, just add one more argument to error_setg:
>
> error_setg(errp, 12345, "Device %s is not found", device_name);
>
> - it's enough grep-able.

error_setg() already records source file and line number in the Error
object, so that error_handle_fatal(&error_abort, err) can report them.

Making the programmer pick and pass an error ID at every call site is
onerous.  More so when the error ID should be globally unique.

With GLib's domain, code, the code needs only be unique within the
domain, but you still have to define globally unique domains.
Differently onerous.

We could have -msg,debug=on make error_report_err() report the Error
object's source file and line number.  Doesn't help for the many direct
uses of error_report().  To cover those, we'd have to turn
error_report() into a macro, similar to how error_setg() works.



  parent reply	other threads:[~2020-04-01 15:08 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01  9:02 Questionable aspects of QEMU Error's design Markus Armbruster
2020-04-01 12:10 ` Vladimir Sementsov-Ogievskiy
2020-04-01 12:14   ` Vladimir Sementsov-Ogievskiy
2020-04-01 14:01   ` Alex Bennée
2020-04-01 15:49     ` Markus Armbruster
2020-04-01 15:05   ` Markus Armbruster [this message]
2020-04-01 12:44 ` Daniel P. Berrangé
2020-04-01 12:47   ` Vladimir Sementsov-Ogievskiy
2020-04-01 15:34   ` Markus Armbruster
2020-04-01 20:15 ` Peter Maydell
2020-04-02  5:31   ` Vladimir Sementsov-Ogievskiy
2020-04-02  9:36     ` BALATON Zoltan
2020-04-02 14:11       ` Vladimir Sementsov-Ogievskiy
2020-04-02 14:34         ` Markus Armbruster
2020-04-02 15:28           ` BALATON Zoltan
2020-04-03  7:09             ` Markus Armbruster
2020-04-02  5:54   ` Markus Armbruster
2020-04-02  6:11     ` Vladimir Sementsov-Ogievskiy
2020-04-02  8:11       ` Peter Maydell
2020-04-02  8:49         ` Daniel P. Berrangé
2020-04-02  8:55         ` Markus Armbruster
2020-04-02 14:35           ` Vladimir Sementsov-Ogievskiy
2020-04-02 15:06             ` Markus Armbruster
2020-04-02 17:17               ` Vladimir Sementsov-Ogievskiy
2020-04-03  7:48                 ` Markus Armbruster
2020-04-02 18:57           ` Paolo Bonzini
2020-04-02  8:47     ` Daniel P. Berrangé
2020-04-02  9:19       ` Alex Bennée
2020-04-02 14:33     ` Eric Blake
2020-04-04  7:59 ` Markus Armbruster
2020-04-04 10:59   ` Markus Armbruster
2020-04-06 14:05     ` Eduardo Habkost
2020-04-06 14:38       ` Eduardo Habkost
2020-04-06 14:10     ` Daniel P. Berrangé
2020-04-27 15:36   ` Markus Armbruster
2020-04-28  5:20     ` Vladimir Sementsov-Ogievskiy
2020-05-14  7:59       ` Vladimir Sementsov-Ogievskiy
2020-05-15  4:28         ` Markus Armbruster
2020-07-03  7:38           ` Markus Armbruster
2020-07-03  9:07             ` Vladimir Sementsov-Ogievskiy
2020-07-03 12:21   ` Markus Armbruster

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=87h7y3fdq3.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.