mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 02:08:12 +03:00
Utilities/lsof: Propagate errors in JSON decoding
This commit is contained in:
parent
fe2ade13e9
commit
904c8634eb
Notes:
sideshowbarker
2024-07-17 21:54:33 +09:00
Author: https://github.com/creator1creeper1 Commit: https://github.com/SerenityOS/serenity/commit/904c8634eb9 Pull-request: https://github.com/SerenityOS/serenity/pull/11420
@ -70,7 +70,12 @@ static Vector<OpenFile> get_open_files_by_pid(pid_t pid)
|
||||
}
|
||||
auto data = file.value()->read_all();
|
||||
|
||||
auto json = JsonValue::from_string(data).release_value_but_fixme_should_propagate_errors();
|
||||
auto json_or_error = JsonValue::from_string(data);
|
||||
if (json_or_error.is_error()) {
|
||||
outln("lsof: {}", json_or_error.error());
|
||||
return Vector<OpenFile>();
|
||||
}
|
||||
auto json = json_or_error.release_value();
|
||||
|
||||
Vector<OpenFile> files;
|
||||
json.as_array().for_each([pid, &files](const JsonValue& object) {
|
||||
|
Loading…
Reference in New Issue
Block a user