Skip to content

[FIX] 요청 취소(AbortError)를 API 오류로 기록해 개발 모드에서 Next.js 오류 화면이 뜨는 문제 (#227) - #228

Merged
SinYusi merged 2 commits into
mainfrom
fix/227-skip-abort-error-log
Oct 4, 2026
Merged

SinYusi merged 2 commits into
mainfrom
fix/227-skip-abort-error-log

Conversation

@SinYusi

@SinYusi SinYusi commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

관련 이슈

closes #227

변경 사항

  • apiRequest의 catch에서 요청 취소(DOMException AbortError)는 기록 없이 원래 오류 그대로 다시 던짐
    • 개발 모드 console.error("💥 API Error")를 남기지 않음 → Next.js 개발 오류 화면이 뜨지 않음
    • NETWORK_ERROR로 바꾸지 않음 → React Query가 취소로 인식하는 원래 오류가 그대로 전달됨

리뷰어 참고 사항

  • 취소는 열차 조회가 React Query에 signal을 넘기면서 생깁니다(조건 변경 재조회·화면 이탈·개발 모드 StrictMode의 다시 마운트). React Query는 이미 정상 흐름으로 처리해 화면 동작에는 영향이 없었고, 이 PR은 기록만 바꿉니다
  • 다른 오류의 개발 모드 기록은 그대로입니다(테스트로 확인)
  • 기록은 원래 NODE_ENV === "development"에서만 찍혀 배포 환경 사용자에게는 영향이 없습니다

추가 정보

검증

  • pnpm exec tsc --noEmit 통과 · pnpm test 295개 통과 · pnpm build 통과
  • 새 테스트 2개: 취소 → 기록 없음·같은 오류 전달(수정 전 코드에서 실패 확인), 취소가 아닌 오류 → 개발 모드 기록 유지

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 버그 수정
    • 요청 취소로 발생한 오류가 네트워크 오류로 변환되거나 개발 모드에서 오류 로그로 기록되지 않고 그대로 전달됩니다.
    • 그 외 API 오류는 기존과 같이 처리됩니다.

@vercel

vercel Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
raillo-frontend Ready Ready Preview Oct 4, 2026 5:27am UTC

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: penggu-dev/raillo-frontend/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 41336855-c308-4add-b0d2-48ac8898581f
📥 Commits

Reviewing files that changed from the base of the PR and between 686c43a and 778b553.

📒 Files selected for processing (2)
  • lib/api.test.ts
  • lib/api.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

apiRequest는 AbortError를 로그에 기록하거나 NETWORK_ERROR로 변환하지 않고 그대로 다시 던집니다. 테스트는 취소 오류와 개발 모드의 HTTP 500 오류 로깅을 확인합니다.

Changes

API 요청 오류 처리

Layer / File(s) Summary
AbortError 처리와 테스트
lib/api.ts, lib/api.test.ts
apiRequest에 AbortError를 그대로 다시 던지는 분기를 추가했습니다. 테스트는 취소 오류가 그대로 전달되고 console.error가 호출되지 않는지 확인합니다. HTTP 500 오류는 개발 모드에서 요청 URL을 포함해 기록되는지 확인합니다. 테스트 종료 후에는 스텁한 환경 변수를 복원합니다.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 778b5

요청 취소 오류는 그대로 전달되고 일반 오류 처리는 유지됩니다. 확인된 변경 범위에서 병합을 막을 구체적인 위험은 없습니다.

Architecture Summary

Architecture risk: 🔵 Low · up to 778b5

The change affects 1 system.

Changed systems: lib

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — lib (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in lib/api.test.ts: afterEach now calls vi.unstubAllEnvs() to restore stubbed environment variables.
  • observed — Modified behavior in lib/api.test.ts: 추가된 테스트는 개발 모드에서 AbortError가 발생할 때 오류 객체가 그대로 전달되고 console.error가 호출되지 않는다고 기대합니다.
  • observed — Modified behavior in lib/api.test.ts: 추가된 테스트는 개발 모드에서 HTTP 500 응답이 발생할 때 오류 상태를 확인하고, 요청 URL을 포함한 API Error 로그가 기록된다고 기대합니다.
  • observed — Modified behavior in lib/api.ts: AbortError를 처리하는 분기가 추가되어 해당 취소 오류는 로깅 및 후속 네트워크 오류 변환을 거치지 않고 그대로 전달됩니다.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 요청 취소 오류를 API 오류로 기록해 개발 모드에서 발생하는 문제를 해결한다는 핵심 변경 사항을 명확히 설명합니다.
Description check ✅ Passed 템플릿의 관련 이슈, 변경 사항, 리뷰어 참고 사항, 추가 정보를 모두 작성했습니다. 구현 내용과 테스트·검증 결과도 구체적으로 설명합니다.
Linked Issues check ✅ Passed #227의 요구를 충족합니다. lib/api.ts는 DOMException의 AbortError를 기록하거나 변환하지 않고 같은 오류를 다시 던집니다. 다른 오류는 기존 개발 모드 기록과 네트워크 오류 처리를 유지합니다. lib/api.test.ts는 취소 오류의 동일성·무기록 동작과 다른 오류의 기록을 확인합니다. PR 설명에 TypeScr…
Out of Scope Changes check ✅ Passed 확인된 변경은 apiRequest의 취소 처리와 관련 테스트에 한정됩니다. 테스트 환경 변수 정리는 테스트 격리를 지원하며 #227의 검증 범위에 포함됩니다. 무관한 변경의 근거는 없습니다.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@SinYusi

SinYusi commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@SinYusi
SinYusi force-pushed the fix/227-skip-abort-error-log branch from 778b553 to 3cd9475 Compare October 4, 2026 05:24
@SinYusi
SinYusi merged commit a1c8b9b into main Oct 4, 2026
2 of 4 checks passed
@SinYusi
SinYusi deleted the fix/227-skip-abort-error-log branch October 4, 2026 05:24

This branch was successfully deployed

1 active deployment
Preview — 3cd94752 Deployed Oct 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FIX] 요청 취소(AbortError)를 API 오류로 기록해 개발 모드에서 Next.js 오류 화면이 뜨는 문제

1 participant