Skip to content

Replace empty catch blocks with explicit exception handling in TarArchive validation methods#1140

Merged
adamhathcock merged 2 commits intoadam/async-creationfrom
copilot/sub-pr-1132-another-one
Jan 16, 2026
Merged

Replace empty catch blocks with explicit exception handling in TarArchive validation methods#1140
adamhathcock merged 2 commits intoadam/async-creationfrom
copilot/sub-pr-1132-another-one

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

Addresses code review feedback about empty catch blocks in TarArchive.Factory.cs. The IsTarFile and IsTarFileAsync methods use catch-all exception handling to detect invalid tar files, but the empty catch blocks obscured intent.

Changes

  • Replace catch { } with explicit catch (Exception) in both validation methods
  • Add comments explaining that all exceptions during header parsing indicate an invalid tar file
catch (Exception)
{
    // Catch all exceptions during tar header reading to determine if this is a valid tar file
    // Invalid tar files or corrupted streams will throw various exceptions
    return false;
}

The behavior is unchanged—these methods probe streams and return false for any exception rather than propagating to callers.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…on handling

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on async creation cleanup pull request Replace empty catch blocks with explicit exception handling in TarArchive validation methods Jan 16, 2026
Copilot AI requested a review from adamhathcock January 16, 2026 09:36
@adamhathcock adamhathcock marked this pull request as ready for review January 16, 2026 09:39
@adamhathcock adamhathcock merged commit 3b10be5 into adam/async-creation Jan 16, 2026
@adamhathcock adamhathcock deleted the copilot/sub-pr-1132-another-one branch January 16, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants