Created more proper NotFound exceptions

This commit is contained in:
2024-08-15 18:53:36 +03:00
parent 604081e047
commit 4c3380ee8d
7 changed files with 37 additions and 10 deletions

View File

@@ -21,7 +21,7 @@ public abstract class GenericRepository<T>(IGenericReader reader, IGenericWriter
public async Task<T> GetOneAsync(Guid id, CancellationToken cancellationToken)
{
var result = await LoadDomain().SingleOrDefaultAsync(a => a.Id == id, cancellationToken);
return result ?? throw new EntityNotFoundException<T>(id);
return result ?? throw new EntityNotFoundByIdException<T>(id);
}
/// <inheritdoc cref="IGenericRepository{T}.AddAsync"/>
@@ -50,4 +50,4 @@ public abstract class GenericRepository<T>(IGenericReader reader, IGenericWriter
{
return reader.GetAll<T>();
}
}
}