From e583112899cbea7494ffdd73d7de380dd5f808c4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 10 Jun 2026 00:54:22 +0900 Subject: feat(phase-c): resolve exception-handling phase-b TODOs * Catch specific exception types instead of broad/placeholder handling. * Drop the shim Countable trait. --- crates/shirabe/src/command/self_update_command.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/src/command/self_update_command.rs') diff --git a/crates/shirabe/src/command/self_update_command.rs b/crates/shirabe/src/command/self_update_command.rs index edc2db8..5948d34 100644 --- a/crates/shirabe/src/command/self_update_command.rs +++ b/crates/shirabe/src/command/self_update_command.rs @@ -26,6 +26,7 @@ use crate::config::Config; use crate::console::input::InputArgument; use crate::console::input::InputOption; use crate::downloader::FilesystemException; +use crate::downloader::TransportException; use crate::factory::Factory; use crate::io::IOInterface; use crate::io::IOInterfaceImmutable; @@ -435,15 +436,17 @@ impl SelfUpdateCommand { ) { Ok(r) => r.get_body().map(|s| s.to_string()), Err(e) => { - // TODO(phase-b): TransportException::get_status_code mapping from anyhow::Error - if false && e.to_string().contains("404") { + if e.downcast_ref::() + .and_then(|te| te.get_status_code()) + == Some(404) + { return Err(InvalidArgumentException { message: format!("Version \"{}\" could not be found.", update_version), code: 0, } .into()); } - return Err(e.into()); + return Err(e); } }; io.write_error3(" ", false, io_interface::NORMAL); -- cgit v1.3.1