Use `catch (Exception e) when`.

pull/10713/head
maliming 4 years ago
parent 90f30251e1
commit a652a04fd2
No known key found for this signature in database
GPG Key ID: 096224957E51C89E

@ -187,17 +187,12 @@ namespace Volo.Abp.Uow.EntityFrameworkCore
)
);
}
catch (Exception e)
catch (Exception e) when (e is InvalidOperationException || e is NotSupportedException)
{
if (e is InvalidOperationException || e is NotSupportedException)
{
Logger.LogError(TransactionsNotSupportedErrorMessage);
Logger.LogException(e);
}
else
{
throw;
}
Logger.LogError(TransactionsNotSupportedErrorMessage);
Logger.LogException(e);
return dbContext;
}
return dbContext;
@ -230,19 +225,12 @@ namespace Volo.Abp.Uow.EntityFrameworkCore
dbContext.Database.BeginTransaction();
}
}
catch (Exception e)
catch (Exception e) when (e is InvalidOperationException || e is NotSupportedException)
{
if (e is InvalidOperationException || e is NotSupportedException)
{
Logger.LogError(TransactionsNotSupportedErrorMessage);
Logger.LogException(e);
return dbContext;
}
else
{
throw;
}
Logger.LogError(TransactionsNotSupportedErrorMessage);
Logger.LogException(e);
return dbContext;
}
}
}
@ -255,19 +243,12 @@ namespace Volo.Abp.Uow.EntityFrameworkCore
*/
dbContext.Database.BeginTransaction();
}
catch (Exception e)
catch (Exception e) when (e is InvalidOperationException || e is NotSupportedException)
{
if (e is InvalidOperationException || e is NotSupportedException)
{
Logger.LogError(TransactionsNotSupportedErrorMessage);
Logger.LogException(e);
return dbContext;
}
else
{
throw;
}
Logger.LogError(TransactionsNotSupportedErrorMessage);
Logger.LogException(e);
return dbContext;
}
}
@ -301,17 +282,12 @@ namespace Volo.Abp.Uow.EntityFrameworkCore
)
);
}
catch (Exception e)
catch (Exception e) when (e is InvalidOperationException || e is NotSupportedException)
{
if (e is InvalidOperationException || e is NotSupportedException)
{
Logger.LogError(TransactionsNotSupportedErrorMessage);
Logger.LogException(e);
}
else
{
throw;
}
Logger.LogError(TransactionsNotSupportedErrorMessage);
Logger.LogException(e);
return dbContext;
}
return dbContext;
@ -349,19 +325,12 @@ namespace Volo.Abp.Uow.EntityFrameworkCore
);
}
}
catch (Exception e)
catch (Exception e) when (e is InvalidOperationException || e is NotSupportedException)
{
if (e is InvalidOperationException || e is NotSupportedException)
{
Logger.LogError(TransactionsNotSupportedErrorMessage);
Logger.LogException(e);
return dbContext;
}
else
{
throw;
}
Logger.LogError(TransactionsNotSupportedErrorMessage);
Logger.LogException(e);
return dbContext;
}
}
}
@ -374,19 +343,12 @@ namespace Volo.Abp.Uow.EntityFrameworkCore
*/
await dbContext.Database.BeginTransactionAsync(GetCancellationToken());
}
catch (Exception e)
catch (Exception e) when (e is InvalidOperationException || e is NotSupportedException)
{
if (e is InvalidOperationException || e is NotSupportedException)
{
Logger.LogError(TransactionsNotSupportedErrorMessage);
Logger.LogException(e);
return dbContext;
}
else
{
throw;
}
Logger.LogError(TransactionsNotSupportedErrorMessage);
Logger.LogException(e);
return dbContext;
}
}

Loading…
Cancel
Save