• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Giorgi / EntityFramework.Exceptions / 12006204713

25 Nov 2024 08:37AM UTC coverage: 88.347% (+0.4%) from 87.949%
12006204713

push

github

Giorgi
Remove extra check for entries as DbUpdateException no longer does the check

129 of 162 branches covered (79.63%)

Branch coverage included in aggregate %.

5 of 5 new or added lines in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

197 of 207 relevant lines covered (95.17%)

28.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.24
/EntityFramework.Exceptions.Common/ExceptionFactory.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Data.Common;
4
using Microsoft.EntityFrameworkCore.ChangeTracking;
5

6
namespace EntityFramework.Exceptions.Common;
7

8
static class ExceptionFactory
9
{
10
    internal static Exception Create<T>(ExceptionProcessorInterceptor<T>.DatabaseError error, Exception exception, IReadOnlyList<EntityEntry> entries) where T : DbException
11
    {
122✔
12
        return error switch
122!
13
        {
122✔
14
            ExceptionProcessorInterceptor<T>.DatabaseError.CannotInsertNull => new CannotInsertNullException("Cannot insert null", exception.InnerException, entries),
18✔
15
            ExceptionProcessorInterceptor<T>.DatabaseError.MaxLength => new MaxLengthExceededException("Maximum length exceeded", exception.InnerException, entries),
16✔
16
            ExceptionProcessorInterceptor<T>.DatabaseError.NumericOverflow => new NumericOverflowException("Numeric overflow", exception.InnerException, entries),
14✔
17
            ExceptionProcessorInterceptor<T>.DatabaseError.ReferenceConstraint => new ReferenceConstraintException("Reference constraint violation", exception.InnerException, entries),
40✔
18
            ExceptionProcessorInterceptor<T>.DatabaseError.UniqueConstraint => new UniqueConstraintException("Unique constraint violation", exception.InnerException, entries),
34✔
UNCOV
19
            _ => null,
×
20
        };
122✔
21
    }
122✔
22
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc