summary refs log tree commit diff stats
path: root/qerror.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2010-03-22 10:29:05 +0100
committerAurelien Jarno <aurelien@aurel32.net>2010-03-27 14:30:38 +0100
commit0167f772d1505b79f2db2f1d3ccad54f2cbe5de1 (patch)
tree6dc1663a784d9b4d0313ae2742c16afc5b0112c1 /qerror.c
parent526f0ac1538378a561b629cb2f99a0349d48bc2f (diff)
downloadfocaccia-qemu-0167f772d1505b79f2db2f1d3ccad54f2cbe5de1.tar.gz
focaccia-qemu-0167f772d1505b79f2db2f1d3ccad54f2cbe5de1.zip
error: Move qerror_report() from qemu-error.[ch] to qerror.[ch]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'qerror.c')
-rw-r--r--qerror.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/qerror.c b/qerror.c
index ff2fbd58e4..eaa1deb286 100644
--- a/qerror.c
+++ b/qerror.c
@@ -9,6 +9,8 @@
  * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
  * See the COPYING.LIB file in the top-level directory.
  */
+
+#include "monitor.h"
 #include "qjson.h"
 #include "qerror.h"
 #include "qemu-common.h"
@@ -377,6 +379,24 @@ void qerror_print(QError *qerror)
     QDECREF(qstring);
 }
 
+void qerror_report_internal(const char *file, int linenr, const char *func,
+                            const char *fmt, ...)
+{
+    va_list va;
+    QError *qerror;
+
+    va_start(va, fmt);
+    qerror = qerror_from_info(file, linenr, func, fmt, &va);
+    va_end(va);
+
+    if (monitor_cur_is_qmp()) {
+        monitor_set_error(cur_mon, qerror);
+    } else {
+        qerror_print(qerror);
+        QDECREF(qerror);
+    }
+}
+
 /**
  * qobject_to_qerror(): Convert a QObject into a QError
  */