Skip to content

Commit

Permalink
Do Not Throw During Test Clean Up (#3156)
Browse files Browse the repository at this point in the history
Do not throw when cleaning up tags for test
  • Loading branch information
wsugarman authored Oct 30, 2023
1 parent b8caefd commit 617db40
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -28,11 +29,19 @@ public DicomTagsManager(IDicomWebClient dicomWebClient)
_tags = new HashSet<string>();
}

[SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Do not throw on test clean up.")]
public async ValueTask DisposeAsync()
{
foreach (var tag in _tags)
foreach (string tag in _tags)
{
await DeleteExtendedQueryTagAsync(tag);
try
{
await DeleteExtendedQueryTagAsync(tag);
}
catch (Exception)
{
// Dispose should not throw for test clean up
}
}
}

Expand Down

0 comments on commit 617db40

Please sign in to comment.