Skip to content

Commit

Permalink
error fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Sep 20, 2023
1 parent 67173d8 commit 82e6a17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions server/src/modules/lottery/dailylottery.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -121,7 +121,7 @@ export class DailyLotteryService implements OnModuleInit {

public async claimRewards(userId: string): Promise<UserResponse> {
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`);
Expand Down
8 changes: 4 additions & 4 deletions server/src/utils/usernotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

0 comments on commit 82e6a17

Please sign in to comment.