Skip to content

Commit ac24f9e

Browse files
committed
Rename T -> TProviderException and use in private methods
1 parent ebfae9b commit ac24f9e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

EntityFramework.Exceptions.Common/ExceptionProcessorInterceptor.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
namespace EntityFramework.Exceptions.Common;
1212

13-
public abstract class ExceptionProcessorInterceptor<T> : IDbCommandInterceptor, ISaveChangesInterceptor
14-
where T : DbException
13+
public abstract class ExceptionProcessorInterceptor<TProviderException> : IDbCommandInterceptor, ISaveChangesInterceptor
14+
where TProviderException : DbException
1515
{
1616
private List<IndexDetails> uniqueIndexDetailsList;
1717
private List<ForeignKeyDetails> foreignKeyDetailsList;
@@ -53,12 +53,12 @@ public Task CommandFailedAsync(DbCommand command, CommandErrorEventData eventDat
5353
return Task.CompletedTask;
5454
}
5555

56-
protected abstract DatabaseError? GetDatabaseError(T dbException);
56+
protected abstract DatabaseError? GetDatabaseError(TProviderException dbException);
5757

5858
[StackTraceHidden]
5959
private void ProcessDbUpdateException(DbContextErrorEventData eventData, DbUpdateException dbUpdateException)
6060
{
61-
if (dbUpdateException == null || eventData.Exception.GetBaseException() is not T providerException) return;
61+
if (dbUpdateException == null || eventData.Exception.GetBaseException() is not TProviderException providerException) return;
6262

6363
var error = GetDatabaseError(providerException);
6464

@@ -82,7 +82,7 @@ private void ProcessDbUpdateException(DbContextErrorEventData eventData, DbUpdat
8282
[StackTraceHidden]
8383
private void ProcessDbException(CommandErrorEventData eventData, DbException dbException)
8484
{
85-
if (dbException == null || eventData.Exception.GetBaseException() is not T providerException) return;
85+
if (dbException == null || eventData.Exception.GetBaseException() is not TProviderException providerException) return;
8686

8787
var error = GetDatabaseError(providerException);
8888

@@ -104,7 +104,7 @@ private void ProcessDbException(CommandErrorEventData eventData, DbException dbE
104104
}
105105

106106
private void SetConstraintDetails(DbContext context, UniqueConstraintException exception,
107-
Exception providerException)
107+
TProviderException providerException)
108108
{
109109
if (uniqueIndexDetailsList == null)
110110
{
@@ -155,7 +155,7 @@ private void SetConstraintDetails(DbContext context, UniqueConstraintException e
155155
}
156156

157157
private void SetConstraintDetails(DbContext context, ReferenceConstraintException exception,
158-
Exception providerException)
158+
TProviderException providerException)
159159
{
160160
if (foreignKeyDetailsList == null)
161161
{

0 commit comments

Comments
 (0)