< Summary - AsyncResponse (Release / net8.0+net10.0 / unit+integration)

Information
Class: AsyncResponse.Internal.MongoTransientFaults
Assembly: AsyncResponse.Channels.MongoDB
File(s): /_/src/Shared/MongoTransientFaults.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 20
Line coverage: 100%
Branch coverage
100%
Covered branches: 16
Total branches: 16
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
IsTransient(...)100%1616100%

File(s)

/_/src/Shared/MongoTransientFaults.cs

#LineLine coverage
 1using MongoDB.Driver;
 2
 3namespace AsyncResponse.Internal;
 4
 5/// <summary>
 6/// Classifies MongoDB driver exceptions as transient (worth an in-process retry) versus
 7/// permanent. Shared by every MongoDB retry loop so the classification cannot drift between the
 8/// channel's publish retry and the transport's publish retry.
 9/// </summary>
 10internal static class MongoTransientFaults
 11{
 12    public static bool IsTransient(Exception exception)
 1813        => exception is not OperationCanceledException
 1814           && (exception is MongoConnectionException
 1815               or MongoNotPrimaryException
 1816               or MongoNodeIsRecoveringException
 1817               or MongoExecutionTimeoutException
 1818               or TimeoutException
 1819               || (exception is MongoException mongoException && mongoException.HasErrorLabel("RetryableWriteError")));
 20}

Methods/Properties

IsTransient(System.Exception)