Skip to content

refactor: 토너먼트 시작 409 시 match 페이지로 복구 이동#331

Merged
iOdiO89 merged 2 commits into
devfrom
refactor/301-tournament-error-handling
Jul 15, 2026
Merged

refactor: 토너먼트 시작 409 시 match 페이지로 복구 이동#331
iOdiO89 merged 2 commits into
devfrom
refactor/301-tournament-error-handling

Conversation

@kanghaeun

@kanghaeun kanghaeun commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

작업 요약

  • 토너먼트 시작 409 시 match 페이지로 복구 이동

작업 세부 내용

status code 대응 전수조사에서 확인된 잔여 항목 처리입니다.
조사 항목 중 대부분(빈 onError 제거, 502 포함 5xx 일괄 처리, generic 토스트)은 #311 에서 이미 해결되었고, 남은 작업인 시작 버튼의 409 맞춤 복구 UX 작업을 진행했습니다.

  • useDeleteTournament — 주석 처리된 빈 onError는 #311에서 이미 제거됨. 409 포함 4xx는 전역 fallback이 서버 detail 토스트로 처리하므로 변경 없음
  • usePostCreateTournamentonError 없음 → 전역 generic 토스트가 커버. 맞춤 UX 불필요로 close

usePostTournamentStartonError 추가

  • 409 (이미 시작됨): 다른 탭/참여자 요청이 먼저 start를 선점한 경우, 에러 토스트 대신 router.push(TOURNAMENT_MATCH)로 이동합니다. match 페이지 서버 컴포넌트가 최신 상태를 조회해 상태별 복구(COMPLETED → 결과 페이지 redirect, IN_PROGRESS → 매치 진행)를 이미 담당하고 있어 해당 로직을 재활용합니다.
  • 409 외 4xx: 개별 onError를 정의하면 전역 4xx fallback이 스킵되므로, 기존 패턴(usePostTournamentItemLink)대로 서버 detail 토스트를 훅 내에서 재현했습니다.
  • 5xx·네트워크: 전역 MutationCache가 항상 처리하므로 훅에서는 건드리지 않았습니다

연관 이슈

closes #301

Summary by CodeRabbit

  • 버그 수정
    • 토너먼트 시작 요청 실패 시 오류 타입과 응답 상태를 먼저 확인한 뒤, 상황에 맞게 예외 처리를 개선했습니다.
    • 이미 시작된 토너먼트(409)인 경우 해당 매치 화면으로 자동 이동합니다.
    • 서버 오류(특정 상태 범위)에서는 보다 구체적인 안내 메시지를 토스트로 표시합니다.

@kanghaeun
kanghaeun requested a review from iOdiO89 July 12, 2026 10:21
@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
depromeet Ready Ready Preview, Comment Jul 15, 2026 12:32am

@github-actions

Copy link
Copy Markdown

Discord 스레드 연동용 메타데이터입니다. discord-pr-bot 워크플로가 자동 생성하며, 수정·삭제하면 PR 과 Discord 알림 연동이 끊깁니다.

@github-actions github-actions Bot added the refactor Extra attention is needed label Jul 12, 2026
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0907299b-237b-443c-a4da-88c5d5b90f44

📥 Commits

Reviewing files that changed from the base of the PR and between f26afd5 and 4a33e36.

📒 Files selected for processing (1)
  • apps/web/src/app/tournament/[id]/create/_hooks/usePostTournamentStart.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/app/tournament/[id]/create/_hooks/usePostTournamentStart.ts

📝 Walkthrough

Walkthrough

토너먼트 시작 mutation에 Axios 에러 판별과 API 에러 응답 타입을 적용했습니다. 409 응답은 매치 화면으로 이동하고, 500 미만 응답은 API 에러 메시지를 토스트로 표시합니다.

Changes

토너먼트 시작 에러 처리

Layer / File(s) Summary
Axios 에러 분기와 상태별 처리
apps/web/src/app/tournament/[id]/create/_hooks/usePostTournamentStart.ts
Axios 에러와 응답 존재 여부를 확인한 뒤, 409 상태에서는 tournamentId 기준으로 매치 화면에 라우팅하고 500 미만 상태에서는 getApiErrorMessage 결과를 에러 토스트로 표시합니다.

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

Suggested reviewers: soyeong0115, iodio89

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 토너먼트 시작 409 발생 시 match 페이지로 복구 이동하는 핵심 변경을 정확히 요약합니다.
Linked Issues check ✅ Passed start API의 409 복구 이동, 기타 4xx 상세 토스트, 5xx·네트워크 전역 위임 요구를 모두 충족합니다.
Out of Scope Changes check ✅ Passed 변경은 usePostTournamentStart의 오류 처리에만 국한되어 목적 밖의 코드 수정은 보이지 않습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/301-tournament-error-handling

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

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/src/app/tournament/`[id]/create/_hooks/usePostTournamentStart.ts:
- Around line 40-41: Update the status condition in the error handling around
getApiErrorMessage to show a toast only for 4xx responses, using a range check
from 400 inclusive to 500 exclusive; preserve the existing behavior that
excludes status 409 if handled elsewhere.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a24ddfa1-e53f-4960-9248-bb0bca7dee1a

📥 Commits

Reviewing files that changed from the base of the PR and between ca3bfa9 and f26afd5.

📒 Files selected for processing (1)
  • apps/web/src/app/tournament/[id]/create/_hooks/usePostTournamentStart.ts

Comment on lines +40 to +41
if (status < 500) {
toast.error(getApiErrorMessage(error));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

토스트 처리를 4xx 응답으로 제한해 주세요.

status < 500은 3xx 또는 1xx 응답까지 포함하므로, PR 요구사항인 “409 이외의 4xx 오류만 토스트 표시”보다 범위가 넓습니다. status >= 400 && status < 500으로 제한하는 편이 안전합니다.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/app/tournament/`[id]/create/_hooks/usePostTournamentStart.ts
around lines 40 - 41, Update the status condition in the error handling around
getApiErrorMessage to show a toast only for 4xx responses, using a range check
from 400 inclusive to 500 exclusive; preserve the existing behavior that
excludes status 409 if handled elsewhere.

@iOdiO89
iOdiO89 force-pushed the refactor/301-tournament-error-handling branch from f26afd5 to 4a33e36 Compare July 15, 2026 00:30
@iOdiO89
iOdiO89 merged commit 2461161 into dev Jul 15, 2026
8 checks passed
@iOdiO89
iOdiO89 deleted the refactor/301-tournament-error-handling branch July 15, 2026 00:34
iOdiO89 pushed a commit that referenced this pull request Jul 19, 2026
* refactor: 토너먼트 시작 409 시 match 페이지로 복구 이동

* refactor: 4xx 에러 문구를 getApiErrorMessage 유틸로 통일
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

토너먼트 삭제·매치·시작·생성 에러 대응

2 participants