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/repository/vcs/vcs_driver.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/repository/vcs/vcs_driver.rs')
| -rw-r--r-- | crates/shirabe/src/repository/vcs/vcs_driver.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/crates/shirabe/src/repository/vcs/vcs_driver.rs b/crates/shirabe/src/repository/vcs/vcs_driver.rs index dc88387..1c05933 100644 --- a/crates/shirabe/src/repository/vcs/vcs_driver.rs +++ b/crates/shirabe/src/repository/vcs/vcs_driver.rs @@ -78,11 +78,13 @@ impl VcsDriverBase { PhpMixed::Array(a) => a.into_iter().map(|(k, v)| (k, *v)).collect(), _ => IndexMap::new(), }; - // TODO(phase-b): map anyhow::Error from HttpDownloader::get into TransportException. self.http_downloader .borrow_mut() .get(url, options) - .map_err(|e| TransportException::new(e.to_string(), 0)) + .map_err(|e| match e.downcast::<TransportException>() { + Ok(te) => te, + Err(other) => TransportException::new(other.to_string(), 0), + }) } // Helper for concrete drivers: produces the same value as the trait default @@ -319,11 +321,13 @@ pub trait VcsDriver: VcsDriverInterface { PhpMixed::Array(a) => a.into_iter().map(|(k, v)| (k, *v)).collect(), _ => IndexMap::new(), }; - // TODO(phase-b): map anyhow::Error from HttpDownloader::get into TransportException. self.http_downloader() .borrow_mut() .get(url, options) - .map_err(|e| TransportException::new(e.to_string(), 0)) + .map_err(|e| match e.downcast::<TransportException>() { + Ok(te) => te, + Err(other) => TransportException::new(other.to_string(), 0), + }) } fn cleanup(&self) {} |
