[Refactor] 도메인 ErrorCode 형식 통일 - #217
Conversation
WalkthroughEmotion/stock/home 도메인의 ErrorCode 형식을 정리·통일하고 일부 enum 상수명과 코드 문자열을 변경하거나 새 enum을 도입했으며, 관련 서비스/프로바이더에서 참조되는 에러 코드 사용을 갱신했습니다. Changes
Sequence Diagram(s)(생성 조건에 해당하지 않아 생략) Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/java/com/umc/finly/domain/home/exception/code/HomeErrorCode.java (1)
19-21: 불필요한 빈 줄을 정리해 주세요.Lines 19-21에 불필요한 빈 줄이 남아있습니다.
♻️ 수정 제안
HOME_WEEKLY_MOOD_INTERNAL_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "HOME_500", "위클리 무드 조회 중 서버 오류가 발생했습니다."); - - - private final HttpStatus httpStatus;
|
|
||
| // 4xx | ||
| ANALYSIS_STOCK_NOT_FOUND(HttpStatus.NOT_FOUND, "ANALYSIS_EMOTION_404_1", "종목을 찾을 수 없습니다."); | ||
| ANALYSIS_STOCK_NOT_FOUND(HttpStatus.NOT_FOUND, "ANALYSIS_EMOTION404_1", "종목을 찾을 수 없습니다."); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# First, verify the file exists and check the enum definition
echo "=== Checking the EmotionAnalysisErrorCode file ==="
find . -name "EmotionAnalysisErrorCode.java" -type f 2>/dev/null
# Check the content around line 13
echo ""
echo "=== Content of EmotionAnalysisErrorCode.java around line 13 ==="
find . -name "EmotionAnalysisErrorCode.java" -type f -exec cat -n {} \; 2>/dev/null | head -30
# Search for all references to ANALYSIS_STOCK_NOT_FOUND
echo ""
echo "=== All references to ANALYSIS_STOCK_NOT_FOUND ==="
rg -n 'ANALYSIS_STOCK_NOT_FOUND' --type=java -C3 2>/dev/null
# Check for any similar naming patterns in the enum
echo ""
echo "=== Check for other enum constants in EmotionAnalysisErrorCode ==="
find . -name "EmotionAnalysisErrorCode.java" -type f -exec cat -n {} \; 2>/dev/nullRepository: Team-Finly/Finly-backend
Length of output: 5579
Enum 상수 이름이 도메인과 불일치합니다.
EmotionAnalysisErrorCode enum의 ANALYSIS_STOCK_NOT_FOUND 상수명은 emotion 도메인에 속하면서도 도메인을 명시하지 않고 있습니다. 코드 문자열 "ANALYSIS_EMOTION404_1"은 emotion을 올바르게 참조하고 있지만, Java 상수명은 도메인 접두사가 없어 일관성이 떨어집니다.
♻️ 수정 제안
- ANALYSIS_STOCK_NOT_FOUND(HttpStatus.NOT_FOUND, "ANALYSIS_EMOTION404_1", "종목을 찾을 수 없습니다.");
+ ANALYSIS_EMOTION_STOCK_NOT_FOUND(HttpStatus.NOT_FOUND, "ANALYSIS_EMOTION404_1", "종목을 찾을 수 없습니다.");EmotionAnalysisServiceImpl.java의 3곳(50줄, 124줄, 175줄)에서 참조하는 코드도 함께 업데이트해야 합니다.
|
|
||
| // 주식 데이터 탭 | ||
| // 4xx | ||
| STOCK_CURRENT_PRICE_NOT_FOUND(HttpStatus.NOT_FOUND, "ANALYSIS_STOCK404", "존재하지 않는 종목입니다."), |
There was a problem hiding this comment.
코드 문자열 형식이 다른 에러 코드와 일관되지 않습니다.
이슈 #216의 표준 형식은 도메인_상태코드_번호입니다. EmotionAnalysisErrorCode는 "ANALYSIS_EMOTION404_1"처럼 번호 접미사를 포함하고 있고, 같은 파일의 5xx 코드도 "ANALYSIS_STOCK502_1", "ANALYSIS_STOCK502_2"로 번호를 사용합니다. 반면 "ANALYSIS_STOCK404"는 번호 접미사가 없어 형식이 불일치합니다.
♻️ 수정 제안
- STOCK_CURRENT_PRICE_NOT_FOUND(HttpStatus.NOT_FOUND, "ANALYSIS_STOCK404", "존재하지 않는 종목입니다."),
+ STOCK_CURRENT_PRICE_NOT_FOUND(HttpStatus.NOT_FOUND, "ANALYSIS_STOCK404_1", "존재하지 않는 종목입니다."),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| STOCK_CURRENT_PRICE_NOT_FOUND(HttpStatus.NOT_FOUND, "ANALYSIS_STOCK404", "존재하지 않는 종목입니다."), | |
| STOCK_CURRENT_PRICE_NOT_FOUND(HttpStatus.NOT_FOUND, "ANALYSIS_STOCK404_1", "존재하지 않는 종목입니다."), |
🔗 관련 이슈
closes #216
📌 작업 내용
🧪 테스트 결과
📸 스크린샷 (선택)
📎 참고 사항 (선택)
Summary by CodeRabbit
Refactor
Chores