-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[톰캣 구현하기 3, 4단계] 오도(문민혁) 미션 제출합니다. #452
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요 오도~
리펙터링이랑 구현잘해주셨네요!
예외처리에 대해서 꼼꼼하게 신경을 많이 쓰신거 같습니다
간단하게 의견 남겨드렸는데 확인부탁드려요 고생하셨습니다~~
tomcat/src/main/java/nextstep/jwp/exception/AuthExceptionType.java
Outdated
Show resolved
Hide resolved
public void service(HttpRequest request, HttpResponse response) throws Exception { | ||
try { | ||
Controller controller = requestMapping.getController(request); | ||
controller.service(request, response); | ||
} catch (BaseException e) { | ||
exceptionControllerAdvice.handleException(e, response); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try catch로 컨트롤러에서 발생한 예외를 잡는거 같은데
catch문에서 BaseException대신 ControllerException을 받는건 어떤가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 controller.service 메서드에서 발생하는 모든 예외들을 해당 try-catch문에서 잡고 있어서 ControllerException만 받으면 LoginController에서 발생하는 AuthException을 못잡을 것 같아요!
tomcat/src/main/java/org/apache/coyote/http11/Http11Processor.java
Outdated
Show resolved
Hide resolved
public class FrontController { | ||
|
||
private final RequestMapping requestMapping; | ||
private final ExceptionControllerAdvice exceptionControllerAdvice; | ||
|
||
public FrontController(RequestMapping requestMapping, ExceptionControllerAdvice exceptionControllerAdvice) { | ||
this.requestMapping = requestMapping; | ||
this.exceptionControllerAdvice = exceptionControllerAdvice; | ||
} | ||
|
||
public void service(HttpRequest request, HttpResponse response) throws Exception { | ||
try { | ||
Controller controller = requestMapping.getController(request); | ||
controller.service(request, response); | ||
} catch (BaseException e) { | ||
exceptionControllerAdvice.handleException(e, response); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
프론트 컨트롤러를 만드신 목적이 무엇인가요??
저는 프론트 컨트롤러의 역할이 여러 컨트롤러에서 발생되는 공통부분들을 한번에 처리하는 역할로 생각하고있었는데
여기서는 따로 공통된 부분을 처리하는 로직이 없는거같아서요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
비지니스 로직에서 예외가 발생하더라도 해당 예외 상황을 HttpProcessor까지 내려보내지 않고 싶었습니다. 예외를 처리해주는 기능을 리퀘스트 매핑에서 하는 것이 어색해서 프론트 컨트롤러라는 클래스에 리퀘스트 매핑과 예외 상황 처리라는 2가지 역할을 부여하게 되었습니다. 사실 프론트 컨트롤러라는 이름이 적절한 이름인지는 모르겠습니다 😭
Kudos, SonarCloud Quality Gate passed! 0 Bugs 0.0% Coverage The version of Java (11.0.20.1) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. |
오도 리뷰 반영이랑 답변 확인했습니다~! |
루쿠짱 approve 로 작성하시고 merge 해야져어어어엉 |
안녕하세요 루쿠!
3,4단계 구현해봤습니다~
이번 리뷰도 잘 부탁드립니다 ㅎㅎ