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>
This commit is contained in:
parent
57348c2f18
commit
5577fff738
7
block.c
7
block.c
@ -1262,11 +1262,16 @@ static QDict *parse_json_filename(const char *filename, Error **errp)
|
|||||||
ret = strstart(filename, "json:", &filename);
|
ret = strstart(filename, "json:", &filename);
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
options_obj = qobject_from_json(filename, NULL);
|
options_obj = qobject_from_json(filename, errp);
|
||||||
if (!options_obj) {
|
if (!options_obj) {
|
||||||
|
/* Work around qobject_from_json() lossage TODO fix that */
|
||||||
|
if (errp && !*errp) {
|
||||||
error_setg(errp, "Could not parse the JSON options");
|
error_setg(errp, "Could not parse the JSON options");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
error_prepend(errp, "Could not parse the JSON options: ");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
options = qobject_to_qdict(options_obj);
|
options = qobject_to_qdict(options_obj);
|
||||||
if (!options) {
|
if (!options) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user