Skip to content

Commit

Permalink
fix: enhance error handling in authentication to include BadRequestError
Browse files Browse the repository at this point in the history
  • Loading branch information
seonghunYang committed Sep 20, 2024
1 parent 728d087 commit e11fe1d
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions app/business/services/user/user.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,14 @@ export async function authenticate(prevState: FormState, formData: FormData): Pr
}
} catch (error) {
// 명세와 다르게 에러가 발생할 경우 BadRequestError가 아니라 UnauthorizedError가 발생
if (error instanceof UnauthorizedError) {
if (error instanceof UnauthorizedError || error instanceof BadRequestError) {
// 잘못된 요청 처리 로직
return {
isSuccess: false,
isFailure: true,
validationError: {},
message: '아이디 또는 비밀번호가 일치하지 않습니다.',
};
} else if (error instanceof BadRequestError) {
// 잘못된 요청 처리 로직
return {
isSuccess: false,
isFailure: true,
validationError: {},
message: '존재하지 않는 계정입니다',
};
} else {
// 나머지 에러는 더 상위 수준에서 처리
throw error;
Expand Down

0 comments on commit e11fe1d

Please sign in to comment.