Skip to content

Commit 924bf1f

Browse files
committed
fix: address second review comments
1 parent 3ff2b6b commit 924bf1f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/JsonApiDotNetCore.MongoDb/MongoDbRepository.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ public virtual async Task<IReadOnlyCollection<TResource>> GetAsync(QueryLayer la
4747
CancellationToken cancellationToken)
4848
{
4949
if (layer == null) throw new ArgumentNullException(nameof(layer));
50-
var list = await ApplyQueryLayer(layer).ToListAsync(cancellationToken);
51-
return list.AsReadOnly();
50+
51+
var resources = await ApplyQueryLayer(layer).ToListAsync(cancellationToken);
52+
return resources.AsReadOnly();
5253
}
5354

5455
/// <inheritdoc />
@@ -146,12 +147,12 @@ public virtual async Task DeleteAsync(TId id, CancellationToken cancellationToke
146147

147148
if (!result.IsAcknowledged)
148149
{
149-
throw new DataStoreUpdateException(new Exception("Delete operation was not acknowledged by MongoDB"));
150+
throw new DataStoreUpdateException(new Exception($"Failed to delete document with id '{id}', because the operation was not acknowledged by MongoDB."));
150151
}
151152

152153
if (result.DeletedCount == 0)
153154
{
154-
throw new DataStoreUpdateException(new Exception($"No documents were deleted. The id that was being sought was: {id}"));
155+
throw new DataStoreUpdateException(new Exception($"Failed to delete document with id '{id}', because it does not exist."));
155156
}
156157
}
157158

@@ -177,7 +178,7 @@ public virtual Task RemoveFromToManyRelationshipAsync(TResource primaryResource,
177178
}
178179

179180
/// <summary>
180-
/// Implements the foundational repository implementation that uses MongoDB.
181+
/// Implements the foundational Repository layer in the JsonApiDotNetCore architecture that uses MongoDB.
181182
/// </summary>
182183
public class MongoDbRepository<TResource> : MongoDbRepository<TResource, string>
183184
where TResource : class, IIdentifiable<string>

0 commit comments

Comments
 (0)