Try some better error handling for archive.cpp JSON parsing

main
Simon Quigley 7 days ago
parent 5c6bc915ba
commit 2d45cf9983

@ -99,12 +99,17 @@ void archive::parse_json(const std::string& json_data) {
// Process all keys in the JSON object
for (auto& [key, value] : data.items()) {
if (json_map.find(key) != json_map.end()) {
json_map[key](value);
json_map.erase(key);
} else if (readonly_map.find(key) != readonly_map.end()) {
readonly_map[key](value);
readonly_map.erase(key);
try {
if (json_map.find(key) != json_map.end()) {
json_map[key](value);
json_map.erase(key);
} else if (readonly_map.find(key) != readonly_map.end()) {
readonly_map[key](value);
readonly_map.erase(key);
}
} catch (const std::exception& e) {
std::cerr << "Unexpected error during JSON parsing: " << e.what() << std::endl;
continue;
}
}

Loading…
Cancel
Save