From 27764ef4447a02e5c59bbcc7b4547838aae82d89 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 3 Jun 2026 21:05:15 +0900 Subject: refactor(downloader,repository,json): drop stale try/catch TODOs; fix svn getFileContent catch type Remove 17 TODO(phase-b) markers across exception-modeling sites where the existing single-Result closure+match already faithfully models the PHP try/catch (catch paths only rethrow, retry, log, or silently ignore and never yield a recoverable value, so a double Result is unnecessary). Fix SvnDriver::get_file_content to catch only RuntimeException (matching PHP's catch RuntimeException) and extract its .message instead of calling e.to_string() on the anyhow::Error, which would panic while the shim exception Display is unimplemented; other errors now propagate. Co-Authored-By: Claude Opus 4.8 --- crates/shirabe/src/repository/vcs/svn_driver.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/shirabe/src/repository/vcs') diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs index 2812c8d..23ea703 100644 --- a/crates/shirabe/src/repository/vcs/svn_driver.rs +++ b/crates/shirabe/src/repository/vcs/svn_driver.rs @@ -171,7 +171,6 @@ impl SvnDriver { } } - // TODO(phase-b): use anyhow::Result> to model PHP try/catch let base_result = self.get_file_content("composer.json", identifier) .and_then(|file_content| { @@ -259,14 +258,16 @@ impl SvnDriver { (identifier.clone(), String::new()) }; - // TODO(phase-b): use anyhow::Result> to model PHP try/catch let output: String = match self.execute( vec!["svn".to_string(), "cat".to_string()], &format!("{}{}{}", self.base_url, path, rev), ) { Ok(o) => o, Err(e) => { - return Err(TransportException::new(e.to_string(), 0).into()); + if let Some(e) = e.downcast_ref::() { + return Err(TransportException::new(e.message.clone(), 0).into()); + } + return Err(e); } }; if trim(&output, None) == "" { @@ -557,7 +558,6 @@ impl SvnDriver { .set_cache_credentials(self.cache_credentials); } - // TODO(phase-b): use anyhow::Result> to model PHP try/catch match self .util .as_mut() -- cgit v1.3.1