From 82e6a1715e0b5e00b3150de66f9abcef5d1254f4 Mon Sep 17 00:00:00 2001 From: Kyle Kemp Date: Wed, 20 Sep 2023 10:12:55 -0500 Subject: [PATCH] error fixes --- server/src/modules/lottery/dailylottery.service.ts | 4 ++-- server/src/utils/usernotifications.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/modules/lottery/dailylottery.service.ts b/server/src/modules/lottery/dailylottery.service.ts index 42ea239..a116043 100644 --- a/server/src/modules/lottery/dailylottery.service.ts +++ b/server/src/modules/lottery/dailylottery.service.ts @@ -12,7 +12,7 @@ import { EventEmitter2 } from '@nestjs/event-emitter'; import { Cron, CronExpression } from '@nestjs/schedule'; import { endOfToday, startOfLastWeek, startOfToday } from '@utils/date'; import { getPatchesAfterPropChanges } from '@utils/patches'; -import { userSuccessObject } from '@utils/usernotifications'; +import { userError, userSuccessObject } from '@utils/usernotifications'; @Injectable() export class DailyLotteryService implements OnModuleInit { @@ -121,7 +121,7 @@ export class DailyLotteryService implements OnModuleInit { public async claimRewards(userId: string): Promise { const record = await this.getLotteryRecordForToday(userId); - if (!record) throw new NotFoundError('You are not the winner for today'); + if (!record) return userError('You are not the winner for today'); const player = await this.playerService.getPlayerForUser(userId); if (!player) throw new NotFoundError(`Player ${userId} not found`); diff --git a/server/src/utils/usernotifications.ts b/server/src/utils/usernotifications.ts index 5ca2968..7705254 100644 --- a/server/src/utils/usernotifications.ts +++ b/server/src/utils/usernotifications.ts @@ -15,17 +15,17 @@ export function userNotify(message: string, type: string): UserResponse { } export function userErrorObject(message: string) { - return this.userNotifyObject(message, 'error'); + return userNotifyObject(message, 'danger'); } export function userError(message: string): UserResponse { - return this.userNotify(message, 'error'); + return userNotify(message, 'danger'); } export function userSuccessObject(message: string) { - return this.userNotifyObject(message, 'success'); + return userNotifyObject(message, 'success'); } export function userSuccess(message: string): UserResponse { - return this.userNotify(message, 'success'); + return userNotify(message, 'success'); }