[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 01/44] error: Improve examples in error.h's big comment
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v3 01/44] error: Improve examples in error.h's big comment |
Date: |
Mon, 06 Jul 2020 16:33:49 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Markus Armbruster <armbru@redhat.com> writes:
> Show errp instead of &err where &err is actually unusual. Add a
> missing declaration. Add a second error pileup example.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Reviewed-by: Greg Kurz <groug@kaod.org>
> ---
> include/qapi/error.h | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/include/qapi/error.h b/include/qapi/error.h
> index ad5b6e896d..3e64324b7a 100644
> --- a/include/qapi/error.h
> +++ b/include/qapi/error.h
> @@ -16,15 +16,15 @@
> * Error reporting system loosely patterned after Glib's GError.
> *
> * Create an error:
> - * error_setg(&err, "situation normal, all fouled up");
> + * error_setg(errp, "situation normal, all fouled up");
> *
> * Create an error and add additional explanation:
> - * error_setg(&err, "invalid quark");
> - * error_append_hint(&err, "Valid quarks are up, down, strange, "
> + * error_setg(errp, "invalid quark");
> + * error_append_hint(errp, "Valid quarks are up, down, strange, "
> * "charm, top, bottom.\n");
> *
> * Do *not* contract this to
> - * error_setg(&err, "invalid quark\n"
> + * error_setg(errp, "invalid quark\n" // WRONG!
> * "Valid quarks are up, down, strange, charm, top, bottom.");
> *
> * Report an error to the current monitor if we have one, else stderr:
I intend to drop the change from &err to errp, and update the commit
message accordingly.
error_setg(&err, ...) is indeed unusual, and I cleaned up several unwise
uses in PATCH 32+35+39. However, error_append_hint(errp, ...) is bad
advice until Vladimir's ERRP_AUTO_PROPAGATE() makes it work. No need to
get ahead of his work here.
[...]
- [PATCH v3 00/44] Less clumsy error checking, Markus Armbruster, 2020/07/06
- [PATCH v3 11/44] qemu-option: Replace opt_set() by cleaner opt_validate(), Markus Armbruster, 2020/07/06
- [PATCH v3 01/44] error: Improve examples in error.h's big comment, Markus Armbruster, 2020/07/06
- Re: [PATCH v3 01/44] error: Improve examples in error.h's big comment,
Markus Armbruster <=
- [PATCH v3 04/44] macio: Tidy up error handling in macio_newworld_realize(), Markus Armbruster, 2020/07/06
- [PATCH v3 07/44] qemu-option: Make uses of find_desc_by_name() more similar, Markus Armbruster, 2020/07/06
- [PATCH v3 09/44] qemu-option: Simplify around find_default_by_name(), Markus Armbruster, 2020/07/06
- [PATCH v3 14/44] block: Avoid error accumulation in bdrv_img_create(), Markus Armbruster, 2020/07/06
- [PATCH v3 24/44] qom: Use return values to check for error where that's simpler, Markus Armbruster, 2020/07/06
- [PATCH v3 02/44] error: Document Error API usage rules, Markus Armbruster, 2020/07/06
- [PATCH v3 15/44] hmp: Eliminate a variable in hmp_migrate_set_parameter(), Markus Armbruster, 2020/07/06