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
ReactおよびTypeScriptのSupabase Studio向けベストプラクティス。Studioコンポーネントの作成やレビュー時に使用します。ブール値の命名、コンポーネント構造などをカバーしています。
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/内のクエリフック、ミューテーションフック、またはクエリキーを作成またはレビューする際に使用します。—…