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/show_command.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/shirabe/src/command/show_command.rs') diff --git a/crates/shirabe/src/command/show_command.rs b/crates/shirabe/src/command/show_command.rs index 4cc0c204..a3bf7157 100644 --- a/crates/shirabe/src/command/show_command.rs +++ b/crates/shirabe/src/command/show_command.rs @@ -698,7 +698,7 @@ impl Command for ShowCommand { ); self.get_io().write(&JsonFile::encode(&PhpMixed::Array( wrapper.into_iter().collect(), - ))); + ))?); } else { self.display_package_tree(vec![array_tree]); } @@ -829,7 +829,7 @@ impl Command for ShowCommand { ); self.get_io().write(&JsonFile::encode(&PhpMixed::Array( wrapper.into_iter().collect(), - ))); + ))?); } else { self.display_package_tree(array_tree); } @@ -1289,7 +1289,7 @@ impl Command for ShowCommand { let io = self.get_io(); io.write(&JsonFile::encode(&PhpMixed::Array( json_map.into_iter().collect(), - ))); + ))?); } else { if input.borrow().get_option("latest")?.as_bool() == Some(true) && view_data.values().any(|v| !v.is_empty()) @@ -2222,7 +2222,7 @@ impl ShowCommand { self.get_io().write(&JsonFile::encode(&PhpMixed::Array( json.into_iter().collect(), - ))); + ))?); Ok(()) } -- cgit v1.3.1