summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorMarkus Armbruster2017-02-28 22:26:59 +0100
committerMarkus Armbruster2017-03-07 16:07:47 +0100
commit5577fff73822c91efd827dde33b8513a5e03ee8d (patch)
tree17e5eba86f491c08249704585f18f3cead228ee0 /block.c
parentqobject: Propagate parse errors through qobject_from_json() (diff)
downloadqemu-5577fff73822c91efd827dde33b8513a5e03ee8d.tar.gz
qemu-5577fff73822c91efd827dde33b8513a5e03ee8d.tar.xz
qemu-5577fff73822c91efd827dde33b8513a5e03ee8d.zip
block: More detailed syntax error reporting for JSON filenames
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>
Diffstat (limited to 'block.c')
-rw-r--r--block.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/block.c b/block.c
index 5ef5c7c174..fe7bddbe5c 100644
--- 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;
}