From 1ca8e9b3ae63144adec8db53b07b395525dad5ae Mon Sep 17 00:00:00 2001 From: Alexander Wilms Date: Sun, 14 Jul 2024 20:41:22 +0200 Subject: [PATCH] JsonParser::parse(): Print JSON if there were errors while parsing In cases where the file name was not specified, the warning messages were not very useful. Example: ```json File is not a valid JSON file! At line 33, position 1 warning: Comma expected! { "name" : "New Old Heroes", "description" : "New heroes based on old 3DO artwork and other game appearances. Requires Horn of the Abyss.", "modType" : "Heroes", "version" : "1.2.0", "author" : "Aphra", "contact" : "", "heroes" : [ "config/gwenneth.json", "config/balindar.json", "config/nicolas.json", "config/kastore.json", "config/kydoimos.json", "config/athe.json", "config/miseria.json", "config/areshrak.json", "config/pactal.json", "config/zog.json" ], "changelog" : { "1.0.0" : ["Initial release"], "1.1.0" : ["Added Nicolas Gryphonheart and Kastore"], "1.1.1" : ["Bug fixes"], "1.2.0" : ["Added some HotA portrait-only campaign heroes"] }, "depends" : [ "hota.neutralCreatures" ] "keepDisabled" : true } ``` --- lib/json/JsonParser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/json/JsonParser.cpp b/lib/json/JsonParser.cpp index 320005b25..8f8fa0eef 100644 --- a/lib/json/JsonParser.cpp +++ b/lib/json/JsonParser.cpp @@ -57,6 +57,7 @@ JsonNode JsonParser::parse(const std::string & fileName) { logMod->warn("File %s is not a valid JSON file!", fileName); logMod->warn(errors); + logMod->warn("%s", input); } return root; }