Skip to content
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

feat : 커스텀 예외 템플릿 생성 #14

Merged
merged 5 commits into from
Dec 25, 2023
Merged

Conversation

dlswns2480
Copy link
Member

closed #9

⛏ 작업 상세 내용

  • 커스텀 예외 클래스 생성
  • Errorcode enum 생성 -> 상태코드, 에러메세지 필드로 가짐
  • 예외 핸들러 클래스만 생성

📝 작업 요약

  • 예외 템플릿 정의

☑️ 중점적으로 리뷰 할 부분

  • 에러 Response dto에 관해서는 같이 얘기 해보고 만들어야 할 것 같습니다.
  • 예외 핸들러 클래스도 각 핸들러마다 어떤 상태코드를 쓸 지 의논해봐야 할 것 같아 안의 내용은 비워두었습니다.

@dlswns2480 dlswns2480 self-assigned this Dec 21, 2023
@dlswns2480 dlswns2480 linked an issue Dec 21, 2023 that may be closed by this pull request
1 task
Copy link
Collaborator

@kkangh00n kkangh00n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

예외를 커스텀해서 처리 할 일이 생기면

  1. CommonException 상속 받아서 현재 패키지에 넣어주고,
  2. ErrorCode 추가해주고,
  3. ExceptionHandler에서 처리
    하면 되는건가요

- 기존에 구현한 공통 예외(CommonException) 클래스를 상속
Copy link

github-actions bot commented Dec 22, 2023

Test Results

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit 7a12e94.

♻️ This comment has been updated with latest results.

@dlswns2480
Copy link
Member Author

기존에 구현한 예외 관련 클래스들은 따로 새 패키지를 파서 안에 넣는 작업은 굳이 필요하지 않은 것 같아 하지 않았습니다.
대신 커스텀 예외 템플릿 예시로 두개 추가하여 exception 패키지 안 custom 패키지안에 구현하였습니다.
이 패키지 안에 있는 커스텀 예외 클래스는 CommonException을 상속받습니다!
예외 클래스 정의할 일이 생기면 그 패키지 안에서 구현하시면 될 것 같습니다~

public enum ErrorCode {
NOT_EXIST_MEMBER(HttpStatus.BAD_REQUEST, "존재하지 않는 아이디입니다.");

private final HttpStatus httpStatus;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저희 httpStatus 필드 빼고, ExceptionHandler에서 처리하기로 바꿨던 것 같아요!

@hyun2371
Copy link
Member

hyun2371 commented Dec 23, 2023

수고 많으셨습니다~ 깃 커밋 메세지 fix 보다는 feat이 더 적절한 것 같아요!

@kkangh00n
Copy link
Collaborator

고생하셨습니다~! 말씀하신대로 예외는 한 곳에 모아두고, 커스텀 예외가 너무 많아지면 그 때 가서 분류하는 것으로 하죠 ㅎㅎ

@dlswns2480 dlswns2480 merged commit 4202c8c into dev Dec 25, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

feature : 예외 처리 템플릿 구현
3 participants