Skip to content

Commit

Permalink
BLUGA: Json more debug error
Browse files Browse the repository at this point in the history
  • Loading branch information
Saverio976 committed Nov 1, 2023
1 parent 304db36 commit 7227c52
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libs/B-luga/include/B-luga/Json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,16 @@ class Json {
{
auto datas = getDataByJsonType(dataType);
auto begin = indexes.begin();
std::stringstream s;

if (indexes.empty()) {
Logger::fatal(std::string("(getDataByVector<T>): empty list"));
throw std::runtime_error("Json error");
}
for (; begin + 1 != indexes.end(); begin++) {
if (datas[*begin] == nullptr) {
Logger::fatal(std::string("(getDataByVector<T>) Key : '") + *begin + std::string("' is not valid from '") + dataType + std::string("'"));
s << datas;
Logger::fatal(std::string("(getDataByVector<T>) 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];
Expand Down

0 comments on commit 7227c52

Please sign in to comment.