xcally-nest-library 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xcally-nest-library",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -50,7 +50,7 @@ export class GenericRepository<E extends ObjectLiteral> {
50
50
  async update<T extends DeepPartial<E> & IId>(dto: T): Promise<E> {
51
51
  const entityUpdated = await this.repository.update(dto.id, dto as any);
52
52
  if (!entityUpdated.affected) {
53
- throw new Error('Entity not found');
53
+ return undefined;
54
54
  }
55
55
  return this.repository.findOneBy({ id: Equal(dto.id) } as unknown as FindOptionsWhere<E>);
56
56
  }
@@ -88,14 +88,13 @@ export class GenericRepository<E extends ObjectLiteral> {
88
88
  *
89
89
  * @param id - The ID of the entity to retrieve.
90
90
  * @returns A promise that resolves to the retrieved entity.
91
- * @throws Error if the entity is not found.
92
91
  */
93
92
  async findById(id: number): Promise<E> {
94
93
  const entity = await this.repository.findOneBy({
95
94
  id: Equal(id),
96
95
  } as unknown as FindOptionsWhere<E>);
97
96
  if (!entity) {
98
- throw new Error('Entity not found');
97
+ throw undefined;
99
98
  }
100
99
  return entity;
101
100
  }