1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

Utilities/netstat: Propagate errors in JSON decoding

This commit is contained in:
creator1creeper1 2021-12-25 16:41:14 +01:00 committed by Andreas Kling
parent 9c832e3b0f
commit 067e32c023

View file

@ -139,7 +139,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
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()) {
warnln("Error: {}", json_or_error.error());
return 1;
}
auto json = json_or_error.release_value();
Vector<JsonValue> sorted_regions = json.as_array().values();
quick_sort(sorted_regions, [](auto& a, auto& b) {