On 11/2/18 10:11 AM, Vladimir Sementsov-Ogievskiy wrote:
Add a function to export error hint - a pair to error_get_pretty. It's
needed to handle errors by hand, where we can't just report it or
propagate.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
---
  include/qapi/error.h | 5 +++++
  util/error.c         | 5 +++++
  2 files changed, 10 insertions(+)

I'll have to see how this is used before agreeing to it, but the code itself is fine if the series does indeed warrant it. I wouldn't mind Markus chiming in on the topic, either.

Reviewed-by: Eric Blake <[email protected]>

+const char *error_get_hint(const Error *err)
+{
+    return err->hint ? err->hint->str : NULL;
+}
+
  void error_report_err(Error *err)
  {
      error_report("%s", error_get_pretty(err));


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to