summaryrefslogtreecommitdiff
path: root/Userland/Utilities/lsusb.cpp
diff options
context:
space:
mode:
authorcreator1creeper1 <creator1creeper1@airmail.cc>2021-12-25 17:24:23 +0100
committerAndreas Kling <kling@serenityos.org>2021-12-30 14:37:02 +0100
commitdfaa6c910cda9fd49e681f10c7efbabed74ef0a6 (patch)
treee9287a06b105cbdb8654d4297d7c05b19304d8fe /Userland/Utilities/lsusb.cpp
parent575a8e6487b785d3c4b3e7666ce3c1e34cdb726c (diff)
downloadserenity-dfaa6c910cda9fd49e681f10c7efbabed74ef0a6.zip
Utilities/lsusb: Propagate errors in JSON decoding
Diffstat (limited to 'Userland/Utilities/lsusb.cpp')
-rw-r--r--Userland/Utilities/lsusb.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Utilities/lsusb.cpp b/Userland/Utilities/lsusb.cpp
index 5ae4e2f3f4..f8801208d9 100644
--- a/Userland/Utilities/lsusb.cpp
+++ b/Userland/Utilities/lsusb.cpp
@@ -46,7 +46,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
auto contents = proc_usb_device->read_all();
- auto json = JsonValue::from_string(contents).release_value_but_fixme_should_propagate_errors();
+ auto json_or_error = JsonValue::from_string(contents);
+ if (json_or_error.is_error()) {
+ warnln("Failed to decode JSON: {}", json_or_error.error());
+ continue;
+ }
+ auto json = json_or_error.release_value();
json.as_array().for_each([usb_db](auto& value) {
auto& device_descriptor = value.as_object();