diff options
author | creator1creeper1 <creator1creeper1@airmail.cc> | 2021-12-25 16:41:14 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-12-30 14:37:02 +0100 |
commit | 067e32c0234b90f2ccc21c94c39f04f73d43c719 (patch) | |
tree | 174c3639ab08b38552a8afd504157ff68b002565 /Userland/Utilities | |
parent | 9c832e3b0fc0df295cc14e3e11b46a8e50acd153 (diff) | |
download | serenity-067e32c0234b90f2ccc21c94c39f04f73d43c719.zip |
Utilities/netstat: Propagate errors in JSON decoding
Diffstat (limited to 'Userland/Utilities')
-rw-r--r-- | Userland/Utilities/netstat.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Utilities/netstat.cpp b/Userland/Utilities/netstat.cpp index 03bd277e9f..70f787cc1d 100644 --- a/Userland/Utilities/netstat.cpp +++ b/Userland/Utilities/netstat.cpp @@ -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) { |