Skip to content

Commit

Permalink
🩹 - exception 코드 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
yws1502 committed Nov 24, 2024
1 parent 5a666a9 commit 3057990
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ export class UsersService {

const userByEmail = await this.usersRepository.findOneBy({ email });
if (userByEmail) {
throw new UnauthorizedException(userExceptionMessage.EXIST_EMAIL);
throw new BadRequestException(userExceptionMessage.EXIST_EMAIL);
}

const userByUsername = await this.usersRepository.findOneBy({ username });
if (userByUsername) {
throw new UnauthorizedException(userExceptionMessage.EXIST_USERNAME);
throw new BadRequestException(userExceptionMessage.EXIST_USERNAME);
}

const hashedPassword = await bcrypt.hashSync(password, 10);
Expand All @@ -76,7 +76,7 @@ export class UsersService {

const user = await this.usersRepository.findOneBy({ email });
if (user) {
throw new UnauthorizedException(userExceptionMessage.EXIST_EMAIL);
throw new BadRequestException(userExceptionMessage.EXIST_EMAIL);
}

return { message: '사용가능한 이메일입니다.' };
Expand All @@ -88,7 +88,7 @@ export class UsersService {
});

if (user) {
throw new UnauthorizedException(userExceptionMessage.EXIST_USERNAME);
throw new BadRequestException(userExceptionMessage.EXIST_USERNAME);
}

return { message: '사용가능한 유저이름입니다.' };
Expand Down

0 comments on commit 3057990

Please sign in to comment.