From 8888e4b8bfeb41e4edd45ab47db8a293e93ded3f Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 3 Jun 2026 00:57:47 +0900 Subject: feat(downloader,repository): wire exception instanceof downcasts via anyhow Resolve the PHP try/catch instanceof checks that select on exception type: TransportException-only catches in RepositorySet, SvnDriver and JsonFile; the RuntimeException/IrrecoverableDownloadException handleError closure and the RuntimeException update-retry catch in DownloadManager. Each uses anyhow::Error::downcast_ref and reads the exception's message field directly (Display is todo\!() on the shim exceptions). PHPUnit\Framework\Exception checks in VcsDownloader are documented as intentionally always-false since the test framework is out of scope. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/downloader/vcs_downloader.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'crates/shirabe/src/downloader/vcs_downloader.rs') diff --git a/crates/shirabe/src/downloader/vcs_downloader.rs b/crates/shirabe/src/downloader/vcs_downloader.rs index b09841e..c3a1611 100644 --- a/crates/shirabe/src/downloader/vcs_downloader.rs +++ b/crates/shirabe/src/downloader/vcs_downloader.rs @@ -149,8 +149,9 @@ pub trait VcsDownloader: match attempt { Ok(promise) => return Ok(promise), Err(e) => { - // rethrow phpunit exceptions to avoid hard to debug bug failures - // TODO(phase-b): downcast to PHPUnit\Framework\Exception + // rethrow phpunit exceptions to avoid hard to debug bug failures. + // PHPUnit\Framework\Exception is out of scope (the test framework is not + // ported), so this instanceof check is always false. let is_phpunit_exception = false; if is_phpunit_exception { return Err(e); @@ -265,8 +266,9 @@ pub trait VcsDownloader: match attempt { Ok(_) => break, Err(e) => { - // rethrow phpunit exceptions to avoid hard to debug bug failures - // TODO(phase-b): downcast to PHPUnit\Framework\Exception + // rethrow phpunit exceptions to avoid hard to debug bug failures. + // PHPUnit\Framework\Exception is out of scope (the test framework is not + // ported), so this instanceof check is always false. let is_phpunit_exception = false; if is_phpunit_exception { return Err(e); @@ -344,8 +346,9 @@ pub trait VcsDownloader: break; } Err(e) => { - // rethrow phpunit exceptions to avoid hard to debug bug failures - // TODO(phase-b): downcast to PHPUnit\Framework\Exception + // rethrow phpunit exceptions to avoid hard to debug bug failures. + // PHPUnit\Framework\Exception is out of scope (the test framework is not + // ported), so this instanceof check is always false. let is_phpunit_exception = false; if is_phpunit_exception { return Err(e); -- cgit v1.3.1