From bceddb20739f5175e7b1220cd29855056d8aee89 Mon Sep 17 00:00:00 2001 From: creator1creeper1 Date: Sat, 25 Dec 2021 16:27:27 +0100 Subject: Utilities/mount: Propagate errors in JSON decoding --- Userland/Utilities/mount.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Userland/Utilities') diff --git a/Userland/Utilities/mount.cpp b/Userland/Utilities/mount.cpp index 118b4941af..05c61de297 100644 --- a/Userland/Utilities/mount.cpp +++ b/Userland/Utilities/mount.cpp @@ -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(); -- cgit v1.2.3