[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Questionable aspects of QEMU Error's design
From: |
Peter Maydell |
Subject: |
Re: Questionable aspects of QEMU Error's design |
Date: |
Wed, 1 Apr 2020 21:15:32 +0100 |
On Wed, 1 Apr 2020 at 10:03, Markus Armbruster <address@hidden> wrote:
>
> QEMU's Error was patterned after GLib's GError. Differences include:
>From my POV the major problem with Error as we have it today
is that it makes the simple process of writing code like
device realize functions horrifically boilerplate heavy;
for instance this is from hw/arm/armsse.c:
object_property_set_link(cpuobj, OBJECT(&s->cpu_container[i]),
"memory", &err);
if (err) {
error_propagate(errp, err);
return;
}
object_property_set_link(cpuobj, OBJECT(s), "idau", &err);
if (err) {
error_propagate(errp, err);
return;
}
object_property_set_bool(cpuobj, true, "realized", &err);
if (err) {
error_propagate(errp, err);
return;
}
16 lines of code just to set 2 properties on an object
and realize it. It's a lot of boilerplate and as
a result we frequently get it wrong or take shortcuts
(eg forgetting the error-handling entirely, calling
error_propagate just once for a whole sequence of
calls, taking the lazy approach and using err_abort
or err_fatal when we ought really to be propagating
an error, etc). I haven't looked at 'auto propagation'
yet, hopefully it will help?
thanks
-- PMM
- 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 <=
- 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
Re: Questionable aspects of QEMU Error's design, Markus Armbruster, 2020/04/02