From 9d6ecdca7b488c655543220c2da721723827d080 Mon Sep 17 00:00:00 2001 From: creator1creeper1 Date: Sat, 25 Dec 2021 16:30:59 +0100 Subject: [PATCH] Utilities/lsirq: Propagate errors in JSON decoding --- Userland/Utilities/lsirq.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Userland/Utilities/lsirq.cpp b/Userland/Utilities/lsirq.cpp index 0bb3e1dc72..634a297f2b 100644 --- a/Userland/Utilities/lsirq.cpp +++ b/Userland/Utilities/lsirq.cpp @@ -39,7 +39,12 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv) outln(" CPU0"); auto file_contents = proc_interrupts->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(); json.as_array().for_each([](auto& value) { auto& handler = value.as_object(); auto purpose = handler.get("purpose").to_string();