diff options
author | creator1creeper1 <creator1creeper1@airmail.cc> | 2021-12-25 16:43:34 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-12-30 14:37:02 +0100 |
commit | 575a8e6487b785d3c4b3e7666ce3c1e34cdb726c (patch) | |
tree | 702729930c9910214715300ca704d480337b9e48 /Userland/Utilities | |
parent | 067e32c0234b90f2ccc21c94c39f04f73d43c719 (diff) | |
download | serenity-575a8e6487b785d3c4b3e7666ce3c1e34cdb726c.zip |
Utilities/arp: Propagate errors in JSON decoding
Diffstat (limited to 'Userland/Utilities')
-rw-r--r-- | Userland/Utilities/arp.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Utilities/arp.cpp b/Userland/Utilities/arp.cpp index bef0fad522..6b51cad357 100644 --- a/Userland/Utilities/arp.cpp +++ b/Userland/Utilities/arp.cpp @@ -91,7 +91,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("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(); quick_sort(sorted_regions, [](auto& a, auto& b) { |