< Summary - ZhEaIsNsAaBn.Libraries coverage (affected: 23 packages)

Information
Class: ZhEaIsNsAaBn.Infrastructure.SqlServer.SqlServerDbErrorClassifier
Assembly: ZhEaIsNsAaBn.Infrastructure.SqlServer
File(s): /home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/DataBasePackages/ZhEaIsNsAaBn.Infrastructure.SqlServer/SqlServerDbErrorClassifier.cs
Line coverage
88%
Covered lines: 8
Uncovered lines: 1
Coverable lines: 9
Total lines: 26
Line coverage: 88.8%
Branch coverage
50%
Covered branches: 3
Total branches: 6
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
.cctor()100%11100%
Classify(...)50%9657.14%

File(s)

/home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/DataBasePackages/ZhEaIsNsAaBn.Infrastructure.SqlServer/SqlServerDbErrorClassifier.cs

#LineLine coverage
 1namespace ZhEaIsNsAaBn.Infrastructure.SqlServer;
 2
 3/// <summary>
 4/// SQL Server <see cref="IDbErrorClassifier"/>: concurrency conflicts, failed saves and <see cref="SqlException"/>s by 
 5/// Registered per context by <c>UseSqlServerInfrastructure()</c>; also usable directly where no context is at hand (e.g
 6/// ASP.NET Core exception handler).
 7/// </summary>
 8public sealed class SqlServerDbErrorClassifier : IDbErrorClassifier
 9{
 4410    private SqlServerDbErrorClassifier() { }
 11
 12
 13    /// <summary>The shared, stateless instance.</summary>
 2214    public static SqlServerDbErrorClassifier Instance { get; } = new();
 15
 16
 17    /// <inheritdoc />
 18    public Error? Classify( Exception exception )
 9419        => exception switch
 9420               {
 021                   DbUpdateConcurrencyException concurrency => concurrency.Classify(),
 1122                   DbUpdateException update                 => update.Classify(),
 723                   SqlException sql                         => sql.Classify(),
 7624                   _                                        => null
 9425               };
 26}