[Qemu-devel] [PATCH 13/24] block: More detailed syntax error reporting for JSON filenames

Markus Armbruster posted 24 patches 8 years, 11 months ago
There is a newer version of this series
[Qemu-devel] [PATCH 13/24] block: More detailed syntax error reporting for JSON filenames
Posted by Markus Armbruster 8 years, 11 months ago
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/block.c b/block.c
index aa6790c..de7d530 100644
--- a/block.c
+++ b/block.c
@@ -1163,9 +1163,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;
     }
 
-- 
2.7.4


Re: [Qemu-devel] [PATCH 13/24] block: More detailed syntax error reporting for JSON filenames
Posted by Kevin Wolf 8 years, 11 months ago
Am 27.02.2017 um 12:20 hat Markus Armbruster geschrieben:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Kevin Wolf <kwolf@redhat.com>