aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/repository/vcs')
-rw-r--r--crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs5
-rw-r--r--crates/shirabe/src/repository/vcs/vcs_driver.rs12
2 files changed, 11 insertions, 6 deletions
diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
index de1f814..7eb253a 100644
--- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
@@ -707,7 +707,6 @@ impl GitBitbucketDriver {
match self.inner.get_contents(url) {
Ok(r) => Ok(r),
Err(e) => {
- // TODO(phase-b): only handle TransportException
let mut bitbucket_util = Bitbucket::new(
self.inner.io.clone(),
self.inner.config.clone(),
@@ -772,7 +771,9 @@ impl GitBitbucketDriver {
match self.setup_fallback_driver(&self.generate_ssh_url()) {
Ok(()) => Ok(true),
Err(e) => {
- // TODO(phase-b): only catch RuntimeException
+ // TODO(phase-c): PHP catches \RuntimeException (and all its subclasses), letting
+ // other exceptions propagate without this cleanup. Modeling that precisely needs the
+ // PHP exception hierarchy, which is intentionally not reproduced (see CLAUDE.md).
self.fallback_driver = None;
self.inner.io.write_error(&format!(
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) {}