diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-10 00:54:22 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-10 00:54:58 +0900 |
| commit | e583112899cbea7494ffdd73d7de380dd5f808c4 (patch) | |
| tree | 1ec002a4d9ab5af5f81ff3bc0ae0ea6a92e44c10 /crates/shirabe/src/command/self_update_command.rs | |
| parent | 436e12381dd79e419dce755718be17b66d73e17f (diff) | |
| download | php-shirabe-e583112899cbea7494ffdd73d7de380dd5f808c4.tar.gz php-shirabe-e583112899cbea7494ffdd73d7de380dd5f808c4.tar.zst php-shirabe-e583112899cbea7494ffdd73d7de380dd5f808c4.zip | |
feat(phase-c): resolve exception-handling phase-b TODOs
* Catch specific exception types instead of broad/placeholder handling.
* Drop the shim Countable trait.
Diffstat (limited to 'crates/shirabe/src/command/self_update_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/self_update_command.rs | 9 |
1 files changed, 6 insertions, 3 deletions
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::<TransportException>() + .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); |
