Open
Conversation
sunwootest
requested changes
Aug 11, 2023
Comment on lines
+12
to
+29
| @ControllerAdvice | ||
| @ResponseStatus(HttpStatus.BAD_REQUEST) | ||
| public class ControllerSupport { | ||
|
|
||
| @ExceptionHandler({MemberNotFoundException.class, LoginFailException.class}) | ||
| public String handle(RuntimeException e) { | ||
| System.out.println(e.getMessage()); | ||
| return "home"; | ||
| } | ||
|
|
||
| @ExceptionHandler(IllegalStateException.class) | ||
| public String handle(IllegalStateException e) { | ||
| System.out.println(e.getMessage()); | ||
| return "members/createMemberForm"; | ||
| } | ||
|
|
||
|
|
||
| } |
Collaborator
There was a problem hiding this comment.
Restful한 API가 아니게 되어버렸네요. axios가 생소하더라도 html을 수정해보세요 :)
|
|
||
| @ExceptionHandler(IllegalStateException.class) | ||
| public String handle(IllegalStateException e) { | ||
| System.out.println(e.getMessage()); |
Collaborator
There was a problem hiding this comment.
sout으로 로그를 남기는 것은 지양해야합니다.
Comment on lines
+12
to
+14
| @ControllerAdvice | ||
| @ResponseStatus(HttpStatus.BAD_REQUEST) | ||
| public class ControllerSupport { |
Collaborator
There was a problem hiding this comment.
모든 예외상황을 BAD REQUEST로 처리해야할까요?
| String password = form.getPassword(); | ||
| Optional<Member> optionalMember = memberRepository.findByEmailAndPassword(email, password); | ||
| return optionalMember.orElseThrow(() -> new IllegalStateException("이메일, 비밀번호가 일치하는 회원이 존재하지 않습니다")); | ||
| return optionalMember.orElseThrow(() -> new LoginFailException("이메일, 비밀번호가 일치하는 회원이 존재하지 않습니다")); |
Collaborator
There was a problem hiding this comment.
예외 메시지도 따로 분리할 수 있어보이네요.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.