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/downloader/download_manager.rs | 2 -- crates/shirabe/src/downloader/vcs_downloader.rs | 3 --- 2 files changed, 5 deletions(-) (limited to 'crates/shirabe/src/downloader') diff --git a/crates/shirabe/src/downloader/download_manager.rs b/crates/shirabe/src/downloader/download_manager.rs index 8131bcf..b230ae3 100644 --- a/crates/shirabe/src/downloader/download_manager.rs +++ b/crates/shirabe/src/downloader/download_manager.rs @@ -238,7 +238,6 @@ impl DownloadManager { } }; - // TODO(phase-b): use anyhow::Result> to model PHP try/catch let result = match downloader .download3(package.clone(), &target_dir, prev_package.clone()) .await @@ -363,7 +362,6 @@ impl DownloadManager { let initial_type = self.get_downloader_type(initial_downloader.unwrap()); let target_type = self.get_downloader_type(downloader.unwrap()); if initial_type == target_type { - // TODO(phase-b): use anyhow::Result> to model PHP try/catch match downloader .unwrap() .update(initial.clone(), target.clone(), &target_dir) diff --git a/crates/shirabe/src/downloader/vcs_downloader.rs b/crates/shirabe/src/downloader/vcs_downloader.rs index c3a1611..fadfa98 100644 --- a/crates/shirabe/src/downloader/vcs_downloader.rs +++ b/crates/shirabe/src/downloader/vcs_downloader.rs @@ -142,7 +142,6 @@ pub trait VcsDownloader: let mut urls = self.prepare_urls(package.get_source_urls()); while let Some(url) = array_shift(&mut urls) { - // TODO(phase-b): use anyhow::Result> to model PHP try/catch let attempt: Result> = self .do_download(package.clone(), path, &url, prev_package.clone()) .await; @@ -260,7 +259,6 @@ pub trait VcsDownloader: let mut urls = self.prepare_urls(package.get_source_urls()); while let Some(url) = array_shift(&mut urls) { - // TODO(phase-b): use anyhow::Result> to model PHP try/catch let attempt: Result> = self.do_install(package.clone(), path, &url).await; match attempt { @@ -336,7 +334,6 @@ pub trait VcsDownloader: let mut exception: Option = None; while let Some(url) = array_shift(&mut urls) { - // TODO(phase-b): use anyhow::Result> to model PHP try/catch let attempt: Result> = self .do_update(initial.clone(), target.clone(), path, &url) .await; -- cgit v1.3.1