From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: thuth@redhat.com, vilanova@ac.upc.edu, dgilbert@redhat.com
Subject: [Qemu-devel] [PATCH 1/2] error: Improve documentation some more
Date: Wed, 3 Feb 2016 19:03:47 +0100 [thread overview]
Message-ID: <1454522628-28294-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1454522628-28294-1-git-send-email-armbru@redhat.com>
Don't claim error_report_err() always reports to stderr. It actually
reports to the current monitor when we have one.
Clarify intended use of error_abort and error_fatal.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
include/qapi/error.h | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/include/qapi/error.h b/include/qapi/error.h
index 45d6c72..e64fe54 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -27,11 +27,11 @@
* error_setg(&err, "invalid quark\n"
* "Valid quarks are up, down, strange, charm, top, bottom.");
*
- * Report an error to stderr:
+ * Report an error to the current monitor if we have one, else stderr:
* error_report_err(err);
* This frees the error object.
*
- * Report an error to stderr with additional text prepended:
+ * Likewise, but with additional text prepended:
* error_reportf_err(err, "Could not frobnicate '%s': ", name);
*
* Report an error somewhere else:
@@ -162,6 +162,9 @@ ErrorClass error_get_class(const Error *err);
* human-readable error message is made from printf-style @fmt, ...
* The resulting message should be a single phrase, with no newline or
* trailing punctuation.
+ * Please don't error_setg(&error_fatal, ...), use error_report() and
+ * exit(), because that's more obvious.
+ * Likewise, don't error_setg(&error_abort, ...), use assert().
*/
#define error_setg(errp, fmt, ...) \
error_setg_internal((errp), __FILE__, __LINE__, __func__, \
@@ -213,6 +216,8 @@ void error_setg_win32_internal(Error **errp,
* the error object.
* Else, move the error object from @local_err to *@dst_errp.
* On return, @local_err is invalid.
+ * Please don't error_propagate(&error_fatal, ...), use
+ * error_report_err() and exit(), because that's more obvious.
*/
void error_propagate(Error **dst_errp, Error *local_err);
@@ -291,12 +296,14 @@ void error_set_internal(Error **errp,
GCC_FMT_ATTR(6, 7);
/*
- * Pass to error_setg() & friends to abort() on error.
+ * Special error destination to abort on error.
+ * See error_setg() and error_propagate() for details.
*/
extern Error *error_abort;
/*
- * Pass to error_setg() & friends to exit(1) on error.
+ * Special error destination to exit(1) on error.
+ * See error_setg() and error_propagate() for details.
*/
extern Error *error_fatal;
--
2.4.3
next prev parent reply other threads:[~2016-02-03 18:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 18:03 [Qemu-devel] [PATCH 0/2] error: Documentation updates Markus Armbruster
2016-02-03 18:03 ` Markus Armbruster [this message]
2016-02-03 18:03 ` [Qemu-devel] [PATCH 2/2] HACKING: Add a section on error handling and reporting Markus Armbruster
2016-02-03 19:17 ` [Qemu-devel] [PATCH 0/2] error: Documentation updates Lluís Vilanova
2016-02-04 6:37 ` Markus Armbruster
2016-02-04 13:05 ` Lluís Vilanova
2016-02-05 8:04 ` Markus Armbruster
2016-02-05 13:45 ` Lluís Vilanova
2016-02-08 8:58 ` Markus Armbruster
2016-02-08 16:15 ` Lluís Vilanova
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454522628-28294-2-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
--cc=vilanova@ac.upc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).