studio-error-handling

작성자: supabase

Supabase Studio의 오류 표시 및 문제 해결 패턴입니다. 다음 경우에 사용하세요.

npx skills add https://github.com/supabase/supabase --skill studio-error-handling

Studio Error Handling Pattern

Full docs and code examples: apps/studio/components/interfaces/ErrorHandling/README.md

How it works

Classification happens in the data layer: handleError in data/fetchers.ts tests the error message against ERROR_PATTERNS and throws the matching error subclass (e.g. ConnectionTimeoutError extends ResponseError). The component (ErrorMatcher) reads errorType from the instance and does an O(1) lookup — it never does regex matching.

handleError() → throws ConnectionTimeoutError → React Query catches → ErrorMatcher reads errorType → renders troubleshooting

Key files

FilePurpose
data/error-patterns.tsArray of { pattern, ErrorClass } — the regex lives here
types/api-errors.tsError classes, KnownErrorType union, ClassifiedError type
ErrorMatcher.tsxComponent — reads errorType, looks up mapping, renders
error-mappings.tsxRecord<KnownErrorType, { id, Troubleshooting: ComponentType }>
errorMappings/ConnectionTimeout.tsxReference troubleshooting component
TroubleshootingSections.tsxReusable accordion section components
TroubleshootingAccordion.tsxAccordion wrapper with telemetry

Usage

Pass the full error object from React Query — not error.message:

{
  isError && (
    <ErrorMatcher title="Failed to load tables" error={error} supportFormParams={{ projectRef }} />
  )
}

What NOT to do

  • Do not pass error.message to ErrorMatcher — pass the full error object so the class is preserved.
  • Do not put regex patterns in error-mappings.tsx — they belong in data/error-patterns.ts.
  • Do not use Object.assign to stamp errorType — throw a proper subclass instead.
  • Do not pass a raw URL string for support — use supportFormParams={{ projectRef }}.
  • Do not put the page title inside the error mapping — it belongs on the <ErrorMatcher> caller.
  • Do not add callback props (onDebugWithAI, onRestartProject) to troubleshooting components — use hooks inside them instead.

supabase의 다른 스킬

studio-e2e-tests
supabase
Supabase Studio용 Playwright E2E 테스트를 작성하고 실행합니다. 요청 시 사용하세요.
pm-the-docs
supabase
Docs-PM 의사결정 지원 도구로, "Write the docs" 작성 프로세스에서 Frame 및 Shape 단계 중 대상 독자, 단계, 교차 범위 결정을 지원합니다…
studio-best-practices
supabase
Supabase Studio를 위한 React 및 TypeScript 모범 사례. Studio 컴포넌트 작성 또는 검토 시 사용 — boolean 명명, 컴포넌트 구조 등을 다룹니다.
docs-content
supabase
Supabase 콘텐츠를 apps/docs 어디에서든 작성, 편집, 구성, 검토하세요 — 가이드, 설명 자료, 튜토리얼, 문제 해결 항목, 참조 문서 등…
studio-mock-api-tests
supabase
Supabase Studio의 컴포넌트 테스트로, MSW를 사용하여 네트워크 계층에서 API 요청을 모킹합니다. React…를 실행하는 컴포넌트 테스트를 작성하거나 검토할 때 사용하세요.
studio-ui-patterns
supabase
Supabase Studio용 디자인 시스템 UI 패턴. 페이지, 양식, 테이블, 차트, 빈 상태, 네비게이션, 카드, 알림 또는 사이드…를 구축하거나 업데이트할 때 사용하세요.
react-hook-form
supabase
모노레포 어디서든 올바른 React Hook Form 사용법 — 데이터 흐름, 구독, 리셋, 더티 상태, 숫자 입력, 제어 입력 규칙. 이것을 로드하세요…
studio-queries
supabase
Supabase Studio에서 데이터 페칭을 위한 React Query 컨벤션. apps/studio/data/에서 쿼리 훅, 뮤테이션 훅, 또는 쿼리 키를 작성하거나 리뷰할 때 사용하세요—…