From 7227c52270f9861636bbb494cace2c3013e20df4 Mon Sep 17 00:00:00 2001 From: Xavier Mitault Date: Wed, 1 Nov 2023 12:41:58 +0000 Subject: [PATCH] BLUGA: Json more debug error --- libs/B-luga/include/B-luga/Json.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/B-luga/include/B-luga/Json.hpp b/libs/B-luga/include/B-luga/Json.hpp index 56a8a29..5e6be0f 100644 --- a/libs/B-luga/include/B-luga/Json.hpp +++ b/libs/B-luga/include/B-luga/Json.hpp @@ -171,6 +171,7 @@ class Json { { auto datas = getDataByJsonType(dataType); auto begin = indexes.begin(); + std::stringstream s; if (indexes.empty()) { Logger::fatal(std::string("(getDataByVector): empty list")); @@ -178,7 +179,8 @@ class Json { } for (; begin + 1 != indexes.end(); begin++) { if (datas[*begin] == nullptr) { - Logger::fatal(std::string("(getDataByVector) Key : '") + *begin + std::string("' is not valid from '") + dataType + std::string("'")); + s << datas; + Logger::fatal(std::string("(getDataByVector) Key : '") + *begin + std::string("' is not valid from '") + dataType + std::string("'; in data: ```") + s.str() + std::string("```")); throw std::runtime_error("Json error"); } datas = datas[*begin];