mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Utilities/lsusb: Propagate errors in JSON decoding
This commit is contained in:
parent
575a8e6487
commit
dfaa6c910c
Notes:
sideshowbarker
2024-07-17 21:54:02 +09:00
Author: https://github.com/creator1creeper1 Commit: https://github.com/SerenityOS/serenity/commit/dfaa6c910cd Pull-request: https://github.com/SerenityOS/serenity/pull/11420
1 changed files with 6 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue