Catalog
fauziyasin-s2m4qw/studio-error-handling

fauziyasin-s2m4qw

studio-error-handling

Error display and troubleshooting pattern for Supabase Studio. Use when rendering API errors in the UI, adding inline troubleshooting steps for a new error type, or wiring up the AI assistant debug button from an error state.

v1.0LATEST
NewUpdated Jul 19, 2026

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

File Purpose
data/error-patterns.ts Array of { pattern, ErrorClass } — the regex lives here
types/api-errors.ts Error classes, KnownErrorType union, ClassifiedError type
ErrorMatcher.tsx Component — reads errorType, looks up mapping, renders
error-mappings.tsx Record<KnownErrorType, { id, Troubleshooting: ComponentType }>
errorMappings/ConnectionTimeout.tsx Reference troubleshooting component
TroubleshootingSections.tsx Reusable accordion section components
TroubleshootingAccordion.tsx Accordion 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.

Overall Score

82/100

Grade

B

Good

Grades are signals, not a certification. Always review a skill yourself before use.

Safety

90

Quality

82

Clarity

85

Completeness

75

Summary

This skill teaches error classification and display patterns for Supabase Studio, specifically how to catch API errors in a data layer, match them against patterns, and render contextual troubleshooting UI. It documents a two-tier system: regex-based pattern matching in `error-patterns.ts` produces error subclasses that React Query catches, then an `ErrorMatcher` component performs O(1) lookups to render appropriate troubleshooting steps.

Detected Capabilities

code navigationpattern documentationcomponent referencearchitecture guidance

Trigger Keywords

Phrases that agents use to match this skill to user intent.

error display patternapi error troubleshootingerror classificationstudio ui errorserror handling component

Use Cases

  • Add new error type to existing error handling system
  • Render API error with troubleshooting steps in Studio UI
  • Wire up AI debug button from error state
  • Create troubleshooting component for new error class
  • Classify custom error messages with pattern matching

Quality Notes

  • Well-scoped documentation focused on a single, specific pattern
  • Clear data flow diagram shows how errors move from classification to rendering
  • Explicit prohibitions list ('What NOT to do') prevents common mistakes and anti-patterns
  • File-to-purpose mapping table makes it easy to locate relevant code
  • Assumes reader has access to reference files in the project; no code duplication
  • Practical usage example with correct and complete error object passing
  • Architecture preserves error subclass information through the entire pipeline
Model: claude-haiku-4-5-20251001Analyzed: Jul 19, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Use fauziyasin-s2m4qw/studio-error-handling in your dev environment

Command Palette

Search for a command to run...