Try some better error handling for archive.cpp JSON parsing

main
Simon Quigley 1 week ago
parent 5c6bc915ba
commit 2d45cf9983

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

Loading…
Cancel
Save