Skip to content

[Refactor] 도메인 ErrorCode 형식 통일 - #217

Merged
ye-zin merged 2 commits into
developfrom
refactor/common-216-errorcode
Feb 11, 2026
Merged

[Refactor] 도메인 ErrorCode 형식 통일#217
ye-zin merged 2 commits into
developfrom
refactor/common-216-errorcode

Conversation

@ye-zin

@ye-zin ye-zin commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

🔗 관련 이슈

관련된 이슈 번호를 적어주세요.

closes #216

📌 작업 내용

이번 PR에서 작업한 내용을 간략히 설명해주세요.

  • ErrorCode 형식 통일

🧪 테스트 결과

Postman 스크린샷, 테스트 통과 여부 등을 첨부해주세요.

📸 스크린샷 (선택)

필요시 스크린샷을 첨부해주세요.

📎 참고 사항 (선택)

리뷰어에게 전달할 내용이 있다면 작성해주세요.

Summary by CodeRabbit

  • Refactor

    • 에러 코드 식별자 정비 및 일관된 형식으로 표준화
    • 4xx/5xx 기준에 따른 에러 분류 체계 정규화
    • 감정·주식 분석 관련 에러 처리 흐름 일관성 강화
  • Chores

    • 중복·불필요한 에러 상수 제거
    • 주식 현재가 조회 관련 에러 집약 및 신규 에러 집합 추가
    • 에러 메시지·상태코드 표현 방식 정리 및 통일

@ye-zin ye-zin linked an issue Feb 11, 2026 that may be closed by this pull request
2 tasks
@coderabbitai

coderabbitai Bot commented Feb 11, 2026

Copy link
Copy Markdown

Walkthrough

Emotion/stock/home 도메인의 ErrorCode 형식을 정리·통일하고 일부 enum 상수명과 코드 문자열을 변경하거나 새 enum을 도입했으며, 관련 서비스/프로바이더에서 참조되는 에러 코드 사용을 갱신했습니다.

Changes

Cohort / File(s) Summary
Emotion errorcode + usages
src/main/java/com/umc/finly/domain/analysis/emotion/exception/code/EmotionAnalysisErrorCode.java, src/main/java/com/umc/finly/domain/analysis/emotion/service/EmotionAnalysisServiceImpl.java
enum 상수 ANALYSIS_STOCK_NOT_FOUNDANALYSIS_EMOTION_STOCK_NOT_FOUND로 이름 변경 및 코드 문자열 "ANALYSIS_EMOTION_404_1""ANALYSIS_EMOTION404_1"로 수정; 서비스 3곳에서 해당 상수 사용 갱신.
Stock analysis errorcodes & provider
src/main/java/com/umc/finly/domain/analysis/stock/exception/code/AnalysisErrorCode.java, src/main/java/com/umc/finly/domain/analysis/stock/exception/code/AnalysisStockErrorCode.java, src/main/java/com/umc/finly/domain/analysis/stock/infra/NaverStockPriceProvider.java
기존 AnalysisErrorCode 일부 상수 파라미터/포맷 정리(단일 행 초기화, 4xx/5xx 주석 추가) 및 새로운 AnalysisStockErrorCode enum 추가; NaverStockPriceProvider의 예외 처리에서 AnalysisStockErrorCode로 대체.
Home errorcode 정리
src/main/java/com/umc/finly/domain/home/exception/code/HomeErrorCode.java
여러 불필요한 상수 제거 및 HOME_MIND_ACCESS_DENIED, HOME_WEEKLY_MOOD_INTERNAL_ERROR 등 4xx/5xx 관련 상수 재정의·추가.

Sequence Diagram(s)

(생성 조건에 해당하지 않아 생략)

Possibly related PRs

Suggested labels

♻️Refactor

Suggested reviewers

  • yjhss
  • jangsh7
  • wonee1
  • na311ng
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목은 ErrorCode 형식 통일이라는 주요 변경사항을 명확하고 간결하게 표현하고 있으며, 변경 내용과 완전히 일치합니다.
Description check ✅ Passed PR 설명은 필수 항목인 관련 이슈(#216)와 작업 내용(ErrorCode 형식 통일)을 포함하고 있으나, 테스트 결과 섹션이 공란으로 남아있습니다.
Linked Issues check ✅ Passed PR의 코드 변경사항들이 #216의 요구사항을 충족합니다: ErrorCode 형식을 도메인_상태코드_번호 형식으로 통일하고, 3개 도메인(emotion, stock, home)에서 일관되게 적용했습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항은 ErrorCode 형식 통일이라는 범위 내의 리팩토링으로, #216 이슈의 목표와 일치합니다. 범위를 벗어난 변경사항은 없습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/common-216-errorcode

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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", "종목을 찾을 수 없습니다.");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 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/null

Repository: 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줄)에서 참조하는 코드도 함께 업데이트해야 합니다.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


// 주식 데이터 탭
// 4xx
STOCK_CURRENT_PRICE_NOT_FOUND(HttpStatus.NOT_FOUND, "ANALYSIS_STOCK404", "존재하지 않는 종목입니다."),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

코드 문자열 형식이 다른 에러 코드와 일관되지 않습니다.

이슈 #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.

Suggested change
STOCK_CURRENT_PRICE_NOT_FOUND(HttpStatus.NOT_FOUND, "ANALYSIS_STOCK404", "존재하지 않는 종목입니다."),
STOCK_CURRENT_PRICE_NOT_FOUND(HttpStatus.NOT_FOUND, "ANALYSIS_STOCK404_1", "존재하지 않는 종목입니다."),

@ye-zin ye-zin self-assigned this Feb 11, 2026
@ye-zin ye-zin added the ♻️Refactor 리팩토링 label Feb 11, 2026
@ye-zin
ye-zin merged commit 937e4a2 into develop Feb 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♻️Refactor 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] 도메인 ErrorCode 형식 통일

3 participants