Skip to content

Commit

Permalink
fix(errors): rethrow some db-adjacent errors
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Aug 31, 2023
1 parent f2fa7df commit 52634c8
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/src/modules/achievements/achievements.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export class AchievementsService {
if (e.code === 11000) {
throw new BadRequestException('achievements id already in use.');
}

throw e;
}

return achievements;
Expand Down
2 changes: 2 additions & 0 deletions server/src/modules/crafting/crafting.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export class CraftingService {
if (e.code === 11000) {
throw new BadRequestException('crafting id already in use.');
}

throw e;
}

return crafting;
Expand Down
2 changes: 2 additions & 0 deletions server/src/modules/discoveries/discoveries.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export class DiscoveriesService {
if (e.code === 11000) {
throw new BadRequestException('discoveries id already in use.');
}

throw e;
}

return discoveries;
Expand Down
1 change: 1 addition & 0 deletions server/src/modules/fight/fight.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export class FightService {
await this.em.flush();
} catch (e) {
this.logger.error(e);
throw e;
}

this.logger.verbose(
Expand Down
2 changes: 2 additions & 0 deletions server/src/modules/inventory/inventory.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export class InventoryService {
if (e.code === 11000) {
throw new BadRequestException('inventory id already in use.');
}

throw e;
}

return inventory;
Expand Down
1 change: 1 addition & 0 deletions server/src/modules/market/market.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export class MarketService {
await this.em.flush();
} catch (e) {
this.logger.error(e);
throw e;
}

this.logger.verbose(
Expand Down
1 change: 1 addition & 0 deletions server/src/modules/notification/notification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export class NotificationService {
await this.em.flush();
} catch (e) {
this.logger.error(e);
throw e;
}

this.logger.verbose(
Expand Down
2 changes: 2 additions & 0 deletions server/src/modules/player/player.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export class PlayerService {
if (e.code === 11000) {
throw new BadRequestException('player id already in use.');
}

throw e;
}

return player;
Expand Down
2 changes: 2 additions & 0 deletions server/src/modules/stats/stats.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export class StatsService {
if (e.code === 11000) {
throw new BadRequestException('stats id already in use.');
}

throw e;
}

return stats;
Expand Down
2 changes: 2 additions & 0 deletions server/src/modules/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export class UserService {
if (e.code === 11000) {
throw new BadRequestException('Email already in use.');
}

throw e;
}

return user;
Expand Down

0 comments on commit 52634c8

Please sign in to comment.