77using System . Linq ;
88using System . Threading ;
99using System . Threading . Tasks ;
10+ using Microsoft . EntityFrameworkCore . ChangeTracking ;
1011
1112namespace EntityFramework . Exceptions . Common ;
1213
@@ -20,7 +21,7 @@ public abstract class ExceptionProcessorDbCommandInterceptor<T> : DbCommandInter
2021 /// <inheritdoc />
2122 public override void CommandFailed ( DbCommand command , CommandErrorEventData eventData )
2223 {
23- ProcessException ( eventData , eventData . Exception as DbUpdateException ) ;
24+ ProcessException ( eventData , eventData . Exception as DbException ) ;
2425
2526 base . CommandFailed ( command , eventData ) ;
2627 }
@@ -29,21 +30,21 @@ public override void CommandFailed(DbCommand command, CommandErrorEventData even
2930 public override Task CommandFailedAsync ( DbCommand command , CommandErrorEventData eventData ,
3031 CancellationToken cancellationToken = new CancellationToken ( ) )
3132 {
32- ProcessException ( eventData , eventData . Exception as DbUpdateException ) ;
33+ ProcessException ( eventData , eventData . Exception as DbException ) ;
3334
3435 return base . CommandFailedAsync ( command , eventData , cancellationToken ) ;
3536 }
3637
3738 [ StackTraceHidden ]
38- private void ProcessException ( CommandErrorEventData eventData , DbUpdateException dbUpdateException )
39+ private void ProcessException ( CommandErrorEventData eventData , DbException dbUpdateException )
3940 {
4041 if ( dbUpdateException == null || eventData . Exception . GetBaseException ( ) is not T providerException ) return ;
4142
4243 var error = GetDatabaseError ( providerException ) ;
4344
4445 if ( error == null ) return ;
4546
46- var exception = ExceptionFactory . Create ( error . Value , dbUpdateException , dbUpdateException . Entries ) ;
47+ var exception = ExceptionFactory . Create ( error . Value , dbUpdateException ) ;
4748
4849 switch ( exception )
4950 {
0 commit comments