Skip to content

Commit

Permalink
feat: 이메일 조회 시 이메일 없을 때 예외처리
Browse files Browse the repository at this point in the history
  • Loading branch information
RyuChaeHyun committed Nov 4, 2023
1 parent 7083d57 commit 1a9ed85
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Binary file modified build/libs/UserService-0.0.1-SNAPSHOT.jar
Binary file not shown.
Binary file modified build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,15 @@ public ResponseEntity<UserResponse> findUserResponseByUserId(@PathVariable("user

@GetMapping("/response_userByEmail/{email}")
public ResponseEntity<UserResponse> findUserResponseByEmail(@PathVariable String email) {
UserResponse userResponse = userService.findUserResponseByEmail(email);
return ResponseEntity.ok().body(userResponse);
try {
UserResponse userResponse = userService.findUserResponseByEmail(email);
return ResponseEntity.ok().body(userResponse);
} catch (BusinessLogicException e) {
ExceptionCode exceptionCode = e.getExceptionCode();
int status = exceptionCode.getStatus();
String message = exceptionCode.getMessage();
return ResponseEntity.status(status).body(new UserResponse(message));
}
}

@PatchMapping("/reissue")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,19 @@ public String register(RequestUser requestUser) {
@Override
public UserResponse getUserResponseByUserId(Long userId) {
UserResponse userResponse = userRepository.findUserResponseByUserId(userId);

if (userResponse == null) {
throw new BusinessLogicException(ExceptionCode.MEMBER_NOT_FOUND);
}

return userResponse;
}

@Override
public UserResponse findUserResponseByEmail(String email) {
return userRepository.findUserResponseByEmail(email);
UserResponse userResponse = userRepository.findUserResponseByEmail(email);
if (userResponse == null) {
throw new BusinessLogicException(ExceptionCode.MEMBER_NOT_FOUND);
}
return userResponse;
}

@Override
Expand Down

0 comments on commit 1a9ed85

Please sign in to comment.