Skip to content

Commit

Permalink
Merge pull request #1799 from qdraw/feature/202411_bugs_3a
Browse files Browse the repository at this point in the history
Feature/202411 bugs 3a
  • Loading branch information
qdraw authored Nov 3, 2024
2 parents c7e6900 + b17d571 commit 22d75f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private async Task SaveChangesDuplicate(DbContext dbContext)
catch ( Exception exception )
{
// Check if the inner exception is a MySqlException
var mySqlException = exception as MySqlException;
var mySqlException = exception.InnerException as MySqlException;
// Skip if Duplicate entry
// MySqlConnector.MySqlException (0x80004005): Duplicate entry for key 'PRIMARY'
// https://github.com/qdraw/starsky/issues/1248 https://github.com/qdraw/starsky/issues/1489
Expand All @@ -299,7 +299,8 @@ private async Task SaveChangesDuplicate(DbContext dbContext)
_logger.LogError($"[SaveChangesDuplicate] T:{exception.GetType()} " +
$"M:{exception.Message} " +
$"I: {exception.InnerException} " +
$"ErrorCode: {mySqlException?.ErrorCode}");
$"IM: {mySqlException?.Message} " +
$"IM ErrorCode: {mySqlException?.ErrorCode}");

throw;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ public async Task AddThumbnailRangeAsync_SomethingElseShould_ExpectedException()
new FakeIWebLogger(), new FakeMemoryCache()
);

// Assert that a MySqlException is thrown when AddThumbnailRangeAsync is called
await Assert.ThrowsExceptionAsync<MySqlException>(async () =>
await Assert.ThrowsExceptionAsync<DbUpdateException>(async () =>
await fakeQuery.AddThumbnailRangeAsync([new ThumbnailResultDataTransferModel("t")]));
}

Expand Down Expand Up @@ -252,7 +251,7 @@ public MySqlSaveDbExceptionContext(DbContextOptions options, string error,
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
{
IsCalledMySqlSaveDbExceptionContext = true;
throw CreateMySqlException(_error, _key);
throw new DbUpdateException("dbUpdate", CreateMySqlException(_error, _key));
}

[SuppressMessage("Usage",
Expand Down

0 comments on commit 22d75f1

Please sign in to comment.