@@ -9,26 +9,13 @@ static class ExceptionFactory
99{
1010 internal static Exception Create < T > ( ExceptionProcessorInterceptor < T > . DatabaseError error , Exception exception , IReadOnlyList < EntityEntry > entries ) where T : DbException
1111 {
12- if ( entries ? . Count > 0 )
13- {
14- return error switch
15- {
16- ExceptionProcessorInterceptor < T > . DatabaseError . CannotInsertNull => new CannotInsertNullException ( "Cannot insert null" , exception . InnerException , entries ) ,
17- ExceptionProcessorInterceptor < T > . DatabaseError . MaxLength => new MaxLengthExceededException ( "Maximum length exceeded" , exception . InnerException , entries ) ,
18- ExceptionProcessorInterceptor < T > . DatabaseError . NumericOverflow => new NumericOverflowException ( "Numeric overflow" , exception . InnerException , entries ) ,
19- ExceptionProcessorInterceptor < T > . DatabaseError . ReferenceConstraint => new ReferenceConstraintException ( "Reference constraint violation" , exception . InnerException , entries ) ,
20- ExceptionProcessorInterceptor < T > . DatabaseError . UniqueConstraint => new UniqueConstraintException ( "Unique constraint violation" , exception . InnerException , entries ) ,
21- _ => null ,
22- } ;
23- }
24-
2512 return error switch
2613 {
27- ExceptionProcessorInterceptor < T > . DatabaseError . CannotInsertNull => new CannotInsertNullException ( "Cannot insert null" , exception . InnerException ) ,
28- ExceptionProcessorInterceptor < T > . DatabaseError . MaxLength => new MaxLengthExceededException ( "Maximum length exceeded" , exception . InnerException ) ,
29- ExceptionProcessorInterceptor < T > . DatabaseError . NumericOverflow => new NumericOverflowException ( "Numeric overflow" , exception . InnerException ) ,
30- ExceptionProcessorInterceptor < T > . DatabaseError . ReferenceConstraint => new ReferenceConstraintException ( "Reference constraint violation" , exception . InnerException ) ,
31- ExceptionProcessorInterceptor < T > . DatabaseError . UniqueConstraint => new UniqueConstraintException ( "Unique constraint violation" , exception . InnerException ) ,
14+ ExceptionProcessorInterceptor < T > . DatabaseError . CannotInsertNull => new CannotInsertNullException ( "Cannot insert null" , exception . InnerException , entries ) ,
15+ ExceptionProcessorInterceptor < T > . DatabaseError . MaxLength => new MaxLengthExceededException ( "Maximum length exceeded" , exception . InnerException , entries ) ,
16+ ExceptionProcessorInterceptor < T > . DatabaseError . NumericOverflow => new NumericOverflowException ( "Numeric overflow" , exception . InnerException , entries ) ,
17+ ExceptionProcessorInterceptor < T > . DatabaseError . ReferenceConstraint => new ReferenceConstraintException ( "Reference constraint violation" , exception . InnerException , entries ) ,
18+ ExceptionProcessorInterceptor < T > . DatabaseError . UniqueConstraint => new UniqueConstraintException ( "Unique constraint violation" , exception . InnerException , entries ) ,
3219 _ => null ,
3320 } ;
3421 }
0 commit comments