Markus Armbruster 4b5766488f error: Fix use of error_prepend() with &error_fatal, &error_abort
From include/qapi/error.h:

  * Pass an existing error to the caller with the message modified:
  *     error_propagate(errp, err);
  *     error_prepend(errp, "Could not frobnicate '%s': ", name);

Fei Li pointed out that doing error_propagate() first doesn't work
well when @errp is &error_fatal or &error_abort: the error_prepend()
is never reached.

Since I doubt fixing the documentation will stop people from getting
it wrong, introduce error_propagate_prepend(), in the hope that it
lures people away from using its constituents in the wrong order.
Update the instructions in error.h accordingly.

Convert existing error_prepend() next to error_propagate to
error_propagate_prepend().  If any of these get reached with
&error_fatal or &error_abort, the error messages improve.  I didn't
check whether that's the case anywhere.

Cc: Fei Li <fli@suse.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181017082702.5581-2-armbru@redhat.com>
2018-10-19 14:51:34 +02:00
..
2017-09-27 11:35:59 +01:00
2018-08-23 18:46:25 +02:00
2016-05-19 16:42:29 +02:00
2018-08-20 11:24:33 +01:00
2016-06-07 18:19:23 +03:00
2016-05-19 16:42:29 +02:00
2016-05-19 16:42:29 +02:00
2018-06-28 19:05:37 +02:00
2017-12-18 17:07:03 +03:00
2016-05-19 16:42:29 +02:00
2016-01-29 15:07:22 +00:00
2018-02-26 12:55:26 +01:00
2018-08-20 11:24:33 +01:00
2016-01-29 15:07:24 +00:00