Apply error handling more universally
This commit is contained in:
parent
2d45cf9983
commit
e8fbd606e8
@ -108,7 +108,6 @@ void archive::parse_json(const std::string& json_data) {
|
||||
readonly_map.erase(key);
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "Unexpected error during JSON parsing: " << e.what() << std::endl;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -68,9 +68,13 @@ void build::parse_json(const std::string& json_data) {
|
||||
|
||||
// Process JSON keys
|
||||
for (auto& [key, value] : data.items()) {
|
||||
if (json_map.find(key) != json_map.end()) {
|
||||
json_map[key](value);
|
||||
json_map.erase(key);
|
||||
try {
|
||||
if (json_map.find(key) != json_map.end()) {
|
||||
json_map[key](value);
|
||||
json_map.erase(key);
|
||||
}
|
||||
} catch (...) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} catch (...) {
|
||||
|
@ -53,9 +53,13 @@ void distribution::parse_json(const std::string& json_data) {
|
||||
|
||||
// Process JSON keys dynamically
|
||||
for (auto& [key, value] : data.items()) {
|
||||
if (json_map.find(key) != json_map.end()) {
|
||||
json_map[key](value);
|
||||
json_map.erase(key);
|
||||
try {
|
||||
if (json_map.find(key) != json_map.end()) {
|
||||
json_map[key](value);
|
||||
json_map.erase(key);
|
||||
}
|
||||
} catch (...) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} catch (const nlohmann::json::parse_error& e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user