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 की और Skills

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 घटकों को लिखते या समीक्षा करते समय उपयोग करें — boolean नामकरण, घटक संरचना,… को शामिल करता है
docs-content
supabase
apps/docs में कहीं भी Supabase सामग्री लिखें, संपादित करें, व्यवस्थित करें और समीक्षा करें — गाइड, व्याख्याकार, ट्यूटोरियल, समस्या निवारण प्रविष्टियाँ, संदर्भ दस्तावेज़, और…
studio-mock-api-tests
supabase
Supabase Studio के लिए कंपोनेंट परीक्षण जो MSW के साथ नेटवर्क परत पर API अनुरोधों को मॉक करते हैं। React… का उपयोग करने वाले कंपोनेंट परीक्षण को लिखते या समीक्षा करते समय उपयोग करें।
studio-ui-patterns
supabase
Design system UI patterns for Supabase Studio. Use when building or updating pages, forms, tables, charts, empty states, navigation, cards, alerts, or side…
react-hook-form
supabase
React Hook Form का सही उपयोग monorepo में कहीं भी — डेटा फ्लो, सब्सक्रिप्शन, रीसेट, डर्टी स्टेट, नंबर इनपुट, और कंट्रोल्ड इनपुट नियम। इसे लोड करें…
studio-queries
supabase
React Query के डेटा लाने के तरीके Supabase Studio में। क्वेरी हुक, म्यूटेशन हुक, या apps/studio/data/ — में क्वेरी कुंजियाँ लिखते या समीक्षा करते समय उपयोग करें…