Skip to content

Commit

Permalink
block: More detailed syntax error reporting for JSON filenames
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Markus Armbruster committed Mar 7, 2017
1 parent 57348c2 commit 5577fff
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions block.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit 5577fff

Please sign in to comment.