1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:47:35 +00:00

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

View file

@ -124,7 +124,12 @@ static bool print_mounts()
} }
auto content = df->read_all(); 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) { json.as_array().for_each([](auto& value) {
auto& fs_object = value.as_object(); auto& fs_object = value.as_object();