mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
Utilities/ifconfig: Propagate errors in JSON decoding
This commit is contained in:
parent
d9b3278074
commit
9c832e3b0f
Notes:
sideshowbarker
2024-07-17 21:54:15 +09:00
Author: https://github.com/creator1creeper1
Commit: 9c832e3b0f
Pull-request: https://github.com/SerenityOS/serenity/pull/11420
1 changed files with 6 additions and 1 deletions
|
@ -45,7 +45,12 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
auto file_contents = file->read_all();
|
||||
auto json = JsonValue::from_string(file_contents).release_value_but_fixme_should_propagate_errors();
|
||||
auto json_or_error = JsonValue::from_string(file_contents);
|
||||
if (json_or_error.is_error()) {
|
||||
outln("Failed to decode JSON: {}", json_or_error.error());
|
||||
return 1;
|
||||
}
|
||||
auto json = json_or_error.release_value();
|
||||
json.as_array().for_each([](auto& value) {
|
||||
auto& if_object = value.as_object();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue