aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command/init_command.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-02 17:32:43 +0900
committernsfisis <nsfisis@gmail.com>2026-08-02 17:32:43 +0900
commit7e31bab9ff7209c9b6d7928a581d7a449846f42e (patch)
treeb121966a169ee74afe04d066576e862a6702bbf6 /crates/shirabe/src/command/init_command.rs
parentebcb4a7f013c0511dd6617686395cef17822d1e2 (diff)
downloadphp-shirabe-7e31bab9ff7209c9b6d7928a581d7a449846f42e.tar.gz
php-shirabe-7e31bab9ff7209c9b6d7928a581d7a449846f42e.tar.zst
php-shirabe-7e31bab9ff7209c9b6d7928a581d7a449846f42e.zip
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 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/init_command.rs')
-rw-r--r--crates/shirabe/src/command/init_command.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs
index ec3f38b5..6923f768 100644
--- a/crates/shirabe/src/command/init_command.rs
+++ b/crates/shirabe/src/command/init_command.rs
@@ -290,7 +290,7 @@ impl Command for InitCommand {
let file_obj = JsonFile::new(Factory::get_composer_file()?, None, None)?;
let options_for_encode: IndexMap<String, PhpMixed> = options.clone().into_iter().collect();
- let json = JsonFile::encode(&PhpMixed::Array(options_for_encode.clone()));
+ let json = JsonFile::encode(&PhpMixed::Array(options_for_encode.clone()))?;
if input.borrow().is_interactive() {
io.write_error3(&format!("\n{}\n", json), true, io_interface::NORMAL);