Utilities/mount: Propagate errors in JSON decoding

This commit is contained in:
creator1creeper1 2021-12-25 16:27:27 +01:00 committed by Andreas Kling
parent 904c8634eb
commit bceddb2073
Notes: sideshowbarker 2024-07-17 21:54:28 +09:00

View File

@ -124,7 +124,12 @@ static bool print_mounts()
}
auto content = df->read_all();
auto json = JsonValue::from_string(content).release_value_but_fixme_should_propagate_errors();
auto json_or_error = JsonValue::from_string(content);
if (json_or_error.is_error()) {
warnln("Failed to decode JSON: {}", json_or_error.error());
return false;
}
auto json = json_or_error.release_value();
json.as_array().for_each([](auto& value) {
auto& fs_object = value.as_object();