Skip to content

Fix empty catch blocks in SqlitePeerStore transaction rollback handling - #7

Closed
mrdevrobot with Copilot wants to merge 4 commits into
feature/snapshotsfrom
copilot/sub-pr-5-again
Closed

Fix empty catch blocks in SqlitePeerStore transaction rollback handling#7
mrdevrobot with Copilot wants to merge 4 commits into
feature/snapshotsfrom
copilot/sub-pr-5-again

Conversation

Copilot AI commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

Description

Addressed code review feedback regarding empty catch blocks that silently swallowed exceptions during transaction rollback attempts in SqlitePeerStore.cs.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Changes Made

  • Added exception logging for all transaction rollback failures with LogWarning level
  • Added missing rollback attempt in PruneOplogAsync general exception handler for consistency
  • Refactored to multi-line format for improved readability

Before:

catch (Exception ex)
{
    _logger.LogError(ex, "Failed to apply batch");
    try { transaction.Rollback(); } catch { }
    throw;
}

After:

catch (Exception ex)
{
    _logger.LogError(ex, "Failed to apply batch");
    try
    {
        transaction.Rollback();
    }
    catch (Exception rollbackEx)
    {
        _logger.LogWarning(rollbackEx, "Failed to rollback transaction after batch failure");
    }
    throw;
}

How Has This Been Tested?

  • Code review completed
  • CodeQL security scan (0 alerts)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 26, 2026 19:22
Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Copilot AI changed the title [WIP] Add feedback resolution for persistence snapshots implementation Fix empty catch blocks in SqlitePeerStore transaction rollback handling Jan 26, 2026
Copilot AI requested a review from mrdevrobot January 26, 2026 19:28
@mrdevrobot
mrdevrobot marked this pull request as ready for review January 26, 2026 19:32
@mrdevrobot mrdevrobot closed this Jan 26, 2026
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