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

Information
Class: AsyncResponse.Internal.MongoTransientFaults
Assembly: AsyncResponse.Transports.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
68%
Covered branches: 11
Total branches: 16
Branch coverage: 68.7%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
IsTransient(...)68.75%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)
 813        => exception is not OperationCanceledException
 814           && (exception is MongoConnectionException
 815               or MongoNotPrimaryException
 816               or MongoNodeIsRecoveringException
 817               or MongoExecutionTimeoutException
 818               or TimeoutException
 819               || (exception is MongoException mongoException && mongoException.HasErrorLabel("RetryableWriteError")));
 20}

Methods/Properties

IsTransient(System.Exception)