]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block: More detailed syntax error reporting for JSON filenames
authorMarkus Armbruster <armbru@redhat.com>
Tue, 28 Feb 2017 21:26:59 +0000 (22:26 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 7 Mar 2017 15:07:47 +0000 (16:07 +0100)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <1488317230-26248-14-git-send-email-armbru@redhat.com>

block.c

diff --git a/block.c b/block.c
index 5ef5c7c1748c6fcaddcea6a18fa049bd932f596d..fe7bddbe5cbb09c1ae7f5dcdb5873e73989aeac3 100644 (file)
--- a/block.c
+++ b/block.c
@@ -1262,9 +1262,14 @@ static QDict *parse_json_filename(const char *filename, Error **errp)
     ret = strstart(filename, "json:", &filename);
     assert(ret);
 
-    options_obj = qobject_from_json(filename, NULL);
+    options_obj = qobject_from_json(filename, errp);
     if (!options_obj) {
-        error_setg(errp, "Could not parse the JSON options");
+        /* Work around qobject_from_json() lossage TODO fix that */
+        if (errp && !*errp) {
+            error_setg(errp, "Could not parse the JSON options");
+            return NULL;
+        }
+        error_prepend(errp, "Could not parse the JSON options: ");
         return NULL;
     }