summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Capitulino2012-08-01 21:29:38 +0200
committerLuiz Capitulino2012-08-13 18:21:31 +0200
commitea25fbca88b223877c45c776b6c0e17e0247439f (patch)
tree2d2ad4f98a7d133c809151a992a93a8c96411e14
parentqerror: add proper ErrorClass value for QERR_ macros (diff)
downloadqemu-ea25fbca88b223877c45c776b6c0e17e0247439f.tar.gz
qemu-ea25fbca88b223877c45c776b6c0e17e0247439f.tar.xz
qemu-ea25fbca88b223877c45c776b6c0e17e0247439f.zip
error: add error_get_class()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
-rw-r--r--error.c5
-rw-r--r--error.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/error.c b/error.c
index 648706aa67..2d34cde654 100644
--- a/error.c
+++ b/error.c
@@ -64,6 +64,11 @@ bool error_is_set(Error **errp)
return (errp && *errp);
}
+ErrorClass error_get_class(const Error *err)
+{
+ return err->err_class;
+}
+
const char *error_get_pretty(Error *err)
{
return err->msg;
diff --git a/error.h b/error.h
index 9678752152..114e24b34b 100644
--- a/error.h
+++ b/error.h
@@ -35,6 +35,11 @@ void error_set(Error **err, ErrorClass err_class, const char *fmt, ...) GCC_FMT_
*/
bool error_is_set(Error **err);
+/*
+ * Get the error class of an error object.
+ */
+ErrorClass error_get_class(const Error *err);
+
/**
* Returns an exact copy of the error passed as an argument.
*/