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);
|
readonly_map.erase(key);
|
||||||
}
|
}
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
std::cerr << "Unexpected error during JSON parsing: " << e.what() << std::endl;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,9 +68,13 @@ void build::parse_json(const std::string& json_data) {
|
|||||||
|
|
||||||
// Process JSON keys
|
// Process JSON keys
|
||||||
for (auto& [key, value] : data.items()) {
|
for (auto& [key, value] : data.items()) {
|
||||||
if (json_map.find(key) != json_map.end()) {
|
try {
|
||||||
json_map[key](value);
|
if (json_map.find(key) != json_map.end()) {
|
||||||
json_map.erase(key);
|
json_map[key](value);
|
||||||
|
json_map.erase(key);
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
@ -53,9 +53,13 @@ void distribution::parse_json(const std::string& json_data) {
|
|||||||
|
|
||||||
// Process JSON keys dynamically
|
// Process JSON keys dynamically
|
||||||
for (auto& [key, value] : data.items()) {
|
for (auto& [key, value] : data.items()) {
|
||||||
if (json_map.find(key) != json_map.end()) {
|
try {
|
||||||
json_map[key](value);
|
if (json_map.find(key) != json_map.end()) {
|
||||||
json_map.erase(key);
|
json_map[key](value);
|
||||||
|
json_map.erase(key);
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (const nlohmann::json::parse_error& e) {
|
} catch (const nlohmann::json::parse_error& e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user