mirror of
https://github.com/RGBCube/serenity
synced 2025-05-29 20:15:11 +00:00
Utilities/arp: Propagate errors in JSON decoding
This commit is contained in:
parent
067e32c023
commit
575a8e6487
1 changed files with 6 additions and 1 deletions
|
@ -91,7 +91,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto file_contents = file->read_all();
|
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("Failed to decode JSON: {}", json_or_error.error());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
auto json = json_or_error.release_value();
|
||||||
|
|
||||||
Vector<JsonValue> sorted_regions = json.as_array().values();
|
Vector<JsonValue> sorted_regions = json.as_array().values();
|
||||||
quick_sort(sorted_regions, [](auto& a, auto& b) {
|
quick_sort(sorted_regions, [](auto& a, auto& b) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue