-
Notifications
You must be signed in to change notification settings - Fork 1
[WTH-107] Swagger 예외 예시 자동 문서화 및 예외 관리 구조 개선 #235
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
Open
hyxklee
wants to merge
16
commits into
develop
Choose a base branch
from
refactor/WTH-107-Weeth-예외-코드-구조-리팩토링-및-스웨거-문서화-강화
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
The head ref may contain hidden characters: "refactor/WTH-107-Weeth-\uC608\uC678-\uCF54\uB4DC-\uAD6C\uC870-\uB9AC\uD329\uD1A0\uB9C1-\uBC0F-\uC2A4\uC6E8\uAC70-\uBB38\uC11C\uD654-\uAC15\uD654"
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1463540
feat: 스웨거 예외처리 자동화를 위한 어노테이션 및 스웨거 설정 추가
hyxklee 843810b
feat: 예외코드 클래스 추가 및 기존 예외 클래스 리팩토링
hyxklee 469283b
feat: 유저 도메인 컨트롤러에 문서 자동화 적용
hyxklee 5301552
feat: 어노테이션 추가
hyxklee bc94f0e
refactor: 불필요 설정 제거
hyxklee 410ac50
refactor: 주석 추가
hyxklee 7a60a7a
refactor: 여러 개의 에러코드 타입을 받을 수 있도록 설정
hyxklee a6d732a
refactor: 여러 개의 에러코드 타입을 받을 수 있도록 설정
hyxklee 957e1a8
feat: JWT 관련 예외 문서화 추가
hyxklee 999494f
feat: Schedule 도메인 관련 예외 문서화 추가
hyxklee fa3025a
feat: Attendance 도메인 관련 예외 문서화 추가
hyxklee 331ae08
feat: Account 도메인 관련 예외 문서화 추가
hyxklee a722218
feat: Penalty 도메인 관련 예외 문서화 추가
hyxklee ba5585f
feat: Board 도메인 관련 예외 문서화 추가
hyxklee 883c04e
refactor: API 정리
hyxklee 297d7db
refactor: 오타 수정
hyxklee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/main/java/leets/weeth/domain/account/application/exception/AccountErrorCode.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package leets.weeth.domain.account.application.exception; | ||
|
|
||
| import leets.weeth.global.common.exception.ErrorCodeInterface; | ||
| import leets.weeth.global.common.exception.ExplainError; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| @Getter | ||
| @AllArgsConstructor | ||
| public enum AccountErrorCode implements ErrorCodeInterface { | ||
|
|
||
| @ExplainError("요청한 회비 장부 ID가 존재하지 않을 때 발생합니다.") | ||
| ACCOUNT_NOT_FOUND(404, HttpStatus.NOT_FOUND, "존재하지 않는 장부입니다."), | ||
|
|
||
| @ExplainError("이미 존재하는 장부를 중복 생성하려고 할 때 발생합니다.") | ||
| ACCOUNT_EXISTS(400, HttpStatus.BAD_REQUEST, "이미 생성된 장부입니다."), | ||
|
|
||
| @ExplainError("요청한 영수증 내역이 존재하지 않을 때 발생합니다.") | ||
| RECEIPT_NOT_FOUND(404, HttpStatus.NOT_FOUND, "존재하지 않는 내역입니다."); | ||
|
|
||
| private final int code; | ||
| private final HttpStatus status; | ||
| private final String message; | ||
| } |
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
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
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
7 changes: 5 additions & 2 deletions
7
src/main/java/leets/weeth/domain/account/presentation/AccountAdminController.java
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
7 changes: 5 additions & 2 deletions
7
src/main/java/leets/weeth/domain/account/presentation/AccountController.java
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
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
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
25 changes: 25 additions & 0 deletions
25
src/main/java/leets/weeth/domain/attendance/application/exception/AttendanceErrorCode.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package leets.weeth.domain.attendance.application.exception; | ||
|
|
||
| import leets.weeth.global.common.exception.ErrorCodeInterface; | ||
| import leets.weeth.global.common.exception.ExplainError; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| @Getter | ||
| @AllArgsConstructor | ||
| public enum AttendanceErrorCode implements ErrorCodeInterface { | ||
|
|
||
| @ExplainError("출석 정보를 찾을 수 없을 때 발생합니다.") | ||
| ATTENDANCE_NOT_FOUND(404, HttpStatus.NOT_FOUND, "출석 정보가 존재하지 않습니다."), | ||
|
|
||
| @ExplainError("입력한 출석 코드가 생성된 코드와 일치하지 않을 때 발생합니다.") | ||
| ATTENDANCE_CODE_MISMATCH(400, HttpStatus.BAD_REQUEST, "출석 코드가 일치하지 않습니다."), | ||
|
|
||
| @ExplainError("사용자가 출석 일정을 직접 수정하려고 시도할 때 발생합니다. (출석 로직 위반)") | ||
| ATTENDANCE_EVENT_TYPE_NOT_MATCH(400, HttpStatus.BAD_REQUEST, "출석일정은 직접 수정할 수 없습니다."); | ||
|
|
||
| private final int code; | ||
| private final HttpStatus status; | ||
| private final String message; | ||
| } |
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
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
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
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
25 changes: 25 additions & 0 deletions
25
src/main/java/leets/weeth/domain/board/application/exception/BoardErrorCode.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package leets.weeth.domain.board.application.exception; | ||
|
|
||
| import leets.weeth.global.common.exception.ErrorCodeInterface; | ||
| import leets.weeth.global.common.exception.ExplainError; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| @Getter | ||
| @AllArgsConstructor | ||
| public enum BoardErrorCode implements ErrorCodeInterface { | ||
|
|
||
| @ExplainError("검색 조건에 맞는 게시글이 하나도 없을 때 발생합니다.") | ||
| NO_SEARCH_RESULT(404, HttpStatus.NOT_FOUND, "일치하는 검색 결과를 찾을 수 없습니다."), | ||
|
|
||
| @ExplainError("요청한 페이지 번호가 유효 범위를 벗어났을 때 발생합니다.") | ||
| PAGE_NOT_FOUND(404, HttpStatus.NOT_FOUND, "존재하지 않는 페이지입니다."), | ||
|
|
||
| @ExplainError("일반 유저가 어드민 전용 카테고리에 접근하려 할 때 발생합니다.") | ||
| CATEGORY_ACCESS_DENIED(403, HttpStatus.FORBIDDEN, "어드민 유저만 접근 가능한 카테고리입니다"); | ||
|
|
||
| private final int code; | ||
| private final HttpStatus status; | ||
| private final String message; | ||
| } | ||
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
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
22 changes: 22 additions & 0 deletions
22
src/main/java/leets/weeth/domain/board/application/exception/NoticeErrorCode.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package leets.weeth.domain.board.application.exception; | ||
|
|
||
| import leets.weeth.global.common.exception.ErrorCodeInterface; | ||
| import leets.weeth.global.common.exception.ExplainError; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| @Getter | ||
| @AllArgsConstructor | ||
| public enum NoticeErrorCode implements ErrorCodeInterface { | ||
|
|
||
| @ExplainError("요청한 공지사항 ID에 해당하는 공지사항이 없을 때 발생합니다.") | ||
| NOTICE_NOT_FOUND(404, HttpStatus.NOT_FOUND, "존재하지 않는 공지사항입니다."), | ||
|
|
||
| @ExplainError("일반 게시판에서 공지사항을 수정하려 하거나, 그 반대의 경우 발생합니다.") | ||
| NOTICE_TYPE_NOT_MATCH(400, HttpStatus.BAD_REQUEST, "공지사항은 공지사항 게시판에서 수정하세요."); | ||
|
|
||
| private final int code; | ||
| private final HttpStatus status; | ||
| private final String message; | ||
| } |
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
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
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
19 changes: 19 additions & 0 deletions
19
src/main/java/leets/weeth/domain/board/application/exception/PostErrorCode.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package leets.weeth.domain.board.application.exception; | ||
|
|
||
| import leets.weeth.global.common.exception.ErrorCodeInterface; | ||
| import leets.weeth.global.common.exception.ExplainError; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| @Getter | ||
| @AllArgsConstructor | ||
| public enum PostErrorCode implements ErrorCodeInterface { | ||
|
|
||
| @ExplainError("요청한 게시글 ID에 해당하는 게시글이 없을 때 발생합니다.") | ||
| POST_NOT_FOUND(404, HttpStatus.NOT_FOUND, "존재하지 않는 게시물입니다."); | ||
|
|
||
| private final int code; | ||
| private final HttpStatus status; | ||
| private final String message; | ||
| } |
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
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
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
Oops, something went wrong.
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.
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.
이제 적용되는 새로운 예외 컨벤션은 application/exception 계층에 위와같이 추가하고 예외클래스를 만들어 호출하면 되는 거 맞겠죠!?