Skip to content

Commit

Permalink
Utilities/mount: Propagate errors in JSON decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
creator1creeper1 authored and awesomekling committed Dec 30, 2021
1 parent 904c863 commit bceddb2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Userland/Utilities/mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit bceddb2

Please sign in to comment.