From 7e31bab9ff7209c9b6d7928a581d7a449846f42e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 2 Aug 2026 17:32:43 +0900 Subject: fix(json): propagate JsonFile::encode errors instead of unwrapping PHP's JsonFile::encode throws a RuntimeException when json_encode fails; the port swallowed that into an .unwrap() marked TODO(phase-c). Return anyhow::Result from encode/encode_with_options and propagate at every call site (print_table and list_repositories become Result-returning to carry it). Co-Authored-By: Claude Fable 5 --- crates/shirabe/src/command/check_platform_reqs_command.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/src/command/check_platform_reqs_command.rs') diff --git a/crates/shirabe/src/command/check_platform_reqs_command.rs b/crates/shirabe/src/command/check_platform_reqs_command.rs index 088c9407..903e0c4c 100644 --- a/crates/shirabe/src/command/check_platform_reqs_command.rs +++ b/crates/shirabe/src/command/check_platform_reqs_command.rs @@ -59,7 +59,7 @@ impl CheckPlatformReqsCommand { output: std::rc::Rc>, results: &[CheckResult], format: &str, - ) { + ) -> anyhow::Result<()> { let io = self.get_io(); if format == "json" { @@ -117,7 +117,7 @@ impl CheckPlatformReqsCommand { }) .collect(); - io.write(&JsonFile::encode(&PhpMixed::List(rows))); + io.write(&JsonFile::encode(&PhpMixed::List(rows))?); } else { let rows: Vec = results .iter() @@ -151,6 +151,8 @@ impl CheckPlatformReqsCommand { self.render_table(rows, output); } + + Ok(()) } } @@ -396,7 +398,7 @@ impl Command for CheckPlatformReqsCommand { .as_string() .unwrap_or("text") .to_string(); - self.print_table(_output, &results, &format); + self.print_table(_output, &results, &format)?; Ok(exit_code) } -- cgit v1.3.1