[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Questionable aspects of QEMU Error's design
From: |
Markus Armbruster |
Subject: |
Re: Questionable aspects of QEMU Error's design |
Date: |
Wed, 01 Apr 2020 17:05:40 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Vladimir Sementsov-Ogievskiy <address@hidden> 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.
- Questionable aspects of QEMU Error's design, Markus Armbruster, 2020/04/01
- Re: Questionable aspects of QEMU Error's design, Vladimir Sementsov-Ogievskiy, 2020/04/01
- Re: Questionable aspects of QEMU Error's design, Daniel P . Berrangé, 2020/04/01
- Re: Questionable aspects of QEMU Error's design, Peter Maydell, 2020/04/01
- Re: Questionable aspects of QEMU Error's design, Vladimir Sementsov-Ogievskiy, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, BALATON Zoltan, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, Vladimir Sementsov-Ogievskiy, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, Markus Armbruster, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, BALATON Zoltan, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, Markus Armbruster, 2020/04/03