aboutsummaryrefslogtreecommitdiff
path: root/qerror.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-02-14 10:19:53 +0100
committerBlue Swirl <blauwirbel@gmail.com>2012-02-14 18:57:33 +0000
commit59f971d451fbabee3194bb565f40846398ee6e6f (patch)
treed775a7dc5f9551b1b8d0e212d11d7091732807b5 /qerror.c
parent0a54a0ce3e7659d7804274fcb058154d52fb8d82 (diff)
qdev: print error message before aborting
qdev_prop_set_* functions are always called by machine init functions that should know what they're doing, so they abort on error. Still, an assert(!errp) does not aid debugging. Print an error before aborting. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'qerror.c')
-rw-r--r--qerror.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/qerror.c b/qerror.c
index 8e6efafe00..f55d435d11 100644
--- a/qerror.c
+++ b/qerror.c
@@ -572,6 +572,14 @@ void qerror_report_err(Error *err)
}
}
+void assert_no_error(Error *err)
+{
+ if (err) {
+ qerror_report_err(err);
+ abort();
+ }
+}
+
/**
* qobject_to_qerror(): Convert a QObject into a QError
*/