aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs/vcs_driver.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/repository/vcs/vcs_driver.rs')
-rw-r--r--crates/shirabe/src/repository/vcs/vcs_driver.rs12
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) {}