[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/41] error: Document how to accumulate multiple err
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 01/41] error: Document how to accumulate multiple errors |
Date: |
Wed, 13 Jan 2016 16:42:59 +0100 |
Suggested-by: Eric Blake <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
---
include/qapi/error.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/include/qapi/error.h b/include/qapi/error.h
index 6285cf5..1480f59 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -76,6 +76,23 @@
* But when all you do with the error is pass it on, please use
* foo(arg, errp);
* for readability.
+ *
+ * Receive and accumulate multiple errors (first one wins):
+ * Error *err = NULL, *local_err = NULL;
+ * foo(arg, &err);
+ * bar(arg, &local_err);
+ * error_propagate(&err, local_err);
+ * if (err) {
+ * handle the error...
+ * }
+ *
+ * Do *not* "optimize" this to
+ * foo(arg, &err);
+ * bar(arg, &err); // WRONG!
+ * if (err) {
+ * handle the error...
+ * }
+ * because this may pass a non-null err to bar().
*/
#ifndef ERROR_H
--
2.4.3
- [Qemu-devel] [PULL 00/41] Error reporting patches for 2016-01-13, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 01/41] error: Document how to accumulate multiple errors,
Markus Armbruster <=
- [Qemu-devel] [PULL 03/41] hw: Inline the qdev_prop_set_drive_nofail() wrapper, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 09/41] error: Don't append a newline when printing the error hint, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 08/41] raven: Mark use of hw_error() in realize() FIXME, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 15/41] audio: Clean up inappropriate and unreachable use of hw_error(), Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 24/41] test-throttle: Simplify qemu_init_main_loop() error handling, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 20/41] error: Use error_report_err() instead of ad hoc prints, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 13/41] isa: Clean up error handling around isa_bus_new(), Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 18/41] error: Use error_report_err() where appropriate (again), Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 21/41] error: Improve documentation, Markus Armbruster, 2016/01/13
- [Qemu-devel] [PULL 36/41] vhdx: Fix "log that needs to be replayed" error message, Markus Armbruster, 2016/01/13