In the method of the class, there is currently no error handling or logging implemented. This can lead to situations where errors during the database operation are silently ignored, making debugging difficult. It is crucial to wrap the database operation in a try-catch block and log the error before rethrowing or handling it appropriately.
Suggested Enhancement
public async Task<bool> DeleteAsync(Guid productId)
{
try
{
var affectedRows = await _dbConnection.ExecuteAsync("delete from Products where Id = @Id;", new { Id = productId });
return affectedRows == 1;
}
catch (Exception ex)
{
// Log the exception details here
throw; // Rethrow the exception or handle it as needed
}
}
Context
This issue is linked to PR #33 and the discussion can be found here.
@italopessoa, please review the details and adjust as necessary.
In the method of the class, there is currently no error handling or logging implemented. This can lead to situations where errors during the database operation are silently ignored, making debugging difficult. It is crucial to wrap the database operation in a try-catch block and log the error before rethrowing or handling it appropriately.
Suggested Enhancement
Context
This issue is linked to PR #33 and the discussion can be found here.
@italopessoa, please review the details and adjust as necessary.