From 52634c81833cd46273b2edffcc061cc56fb55bb3 Mon Sep 17 00:00:00 2001 From: Kyle Kemp Date: Thu, 31 Aug 2023 16:08:36 -0500 Subject: [PATCH] fix(errors): rethrow some db-adjacent errors --- server/src/modules/achievements/achievements.service.ts | 2 ++ server/src/modules/crafting/crafting.service.ts | 2 ++ server/src/modules/discoveries/discoveries.service.ts | 2 ++ server/src/modules/fight/fight.service.ts | 1 + server/src/modules/inventory/inventory.service.ts | 2 ++ server/src/modules/market/market.service.ts | 1 + server/src/modules/notification/notification.service.ts | 1 + server/src/modules/player/player.service.ts | 2 ++ server/src/modules/stats/stats.service.ts | 2 ++ server/src/modules/user/user.service.ts | 2 ++ 10 files changed, 17 insertions(+) diff --git a/server/src/modules/achievements/achievements.service.ts b/server/src/modules/achievements/achievements.service.ts index 97b3aed..28c84e1 100644 --- a/server/src/modules/achievements/achievements.service.ts +++ b/server/src/modules/achievements/achievements.service.ts @@ -39,6 +39,8 @@ export class AchievementsService { if (e.code === 11000) { throw new BadRequestException('achievements id already in use.'); } + + throw e; } return achievements; diff --git a/server/src/modules/crafting/crafting.service.ts b/server/src/modules/crafting/crafting.service.ts index 3858a66..df9b60e 100644 --- a/server/src/modules/crafting/crafting.service.ts +++ b/server/src/modules/crafting/crafting.service.ts @@ -36,6 +36,8 @@ export class CraftingService { if (e.code === 11000) { throw new BadRequestException('crafting id already in use.'); } + + throw e; } return crafting; diff --git a/server/src/modules/discoveries/discoveries.service.ts b/server/src/modules/discoveries/discoveries.service.ts index b175372..0fdb346 100644 --- a/server/src/modules/discoveries/discoveries.service.ts +++ b/server/src/modules/discoveries/discoveries.service.ts @@ -60,6 +60,8 @@ export class DiscoveriesService { if (e.code === 11000) { throw new BadRequestException('discoveries id already in use.'); } + + throw e; } return discoveries; diff --git a/server/src/modules/fight/fight.service.ts b/server/src/modules/fight/fight.service.ts index 17e8990..af4eba2 100644 --- a/server/src/modules/fight/fight.service.ts +++ b/server/src/modules/fight/fight.service.ts @@ -214,6 +214,7 @@ export class FightService { await this.em.flush(); } catch (e) { this.logger.error(e); + throw e; } this.logger.verbose( diff --git a/server/src/modules/inventory/inventory.service.ts b/server/src/modules/inventory/inventory.service.ts index 51e49d9..fd84083 100644 --- a/server/src/modules/inventory/inventory.service.ts +++ b/server/src/modules/inventory/inventory.service.ts @@ -49,6 +49,8 @@ export class InventoryService { if (e.code === 11000) { throw new BadRequestException('inventory id already in use.'); } + + throw e; } return inventory; diff --git a/server/src/modules/market/market.service.ts b/server/src/modules/market/market.service.ts index 688d448..e41714b 100644 --- a/server/src/modules/market/market.service.ts +++ b/server/src/modules/market/market.service.ts @@ -151,6 +151,7 @@ export class MarketService { await this.em.flush(); } catch (e) { this.logger.error(e); + throw e; } this.logger.verbose( diff --git a/server/src/modules/notification/notification.service.ts b/server/src/modules/notification/notification.service.ts index 4a9e59c..9080979 100644 --- a/server/src/modules/notification/notification.service.ts +++ b/server/src/modules/notification/notification.service.ts @@ -59,6 +59,7 @@ export class NotificationService { await this.em.flush(); } catch (e) { this.logger.error(e); + throw e; } this.logger.verbose( diff --git a/server/src/modules/player/player.service.ts b/server/src/modules/player/player.service.ts index c63dc69..3eb3bc1 100644 --- a/server/src/modules/player/player.service.ts +++ b/server/src/modules/player/player.service.ts @@ -56,6 +56,8 @@ export class PlayerService { if (e.code === 11000) { throw new BadRequestException('player id already in use.'); } + + throw e; } return player; diff --git a/server/src/modules/stats/stats.service.ts b/server/src/modules/stats/stats.service.ts index 6a5fc66..fa54fd0 100644 --- a/server/src/modules/stats/stats.service.ts +++ b/server/src/modules/stats/stats.service.ts @@ -36,6 +36,8 @@ export class StatsService { if (e.code === 11000) { throw new BadRequestException('stats id already in use.'); } + + throw e; } return stats; diff --git a/server/src/modules/user/user.service.ts b/server/src/modules/user/user.service.ts index b4186b7..57271d3 100644 --- a/server/src/modules/user/user.service.ts +++ b/server/src/modules/user/user.service.ts @@ -26,6 +26,8 @@ export class UserService { if (e.code === 11000) { throw new BadRequestException('Email already in use.'); } + + throw e; } return user;