mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 07:50:20 +08:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Improve code review guidelines for copilot --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1.5 KiB
1.5 KiB
applyTo
| applyTo |
|---|
| apps/studio/** |
Studio Error Handling Review Rules
All comments are advisory.
Architecture
Errors flow: handleError() → throws typed subclass → React Query catches → ErrorMatcher reads errorType → renders troubleshooting. The component does an O(1) lookup — it never does regex matching.
When to Flag
- PR passes
error.messageinstead of the fullerrorobject toErrorMatcher— the class type is lost - PR puts regex patterns in
error-mappings.tsx— they belong indata/error-patterns.ts - PR uses
Object.assignto stamperrorTypeon an error — should throw a proper subclass instead - PR passes a raw URL string for support links — should use
supportFormParams={{ projectRef }} - PR puts the page title inside the error mapping — it belongs on the
<ErrorMatcher>caller - PR adds callback props (
onDebugWithAI,onRestartProject) to troubleshooting components — use hooks inside them instead
Correct Usage
{isError && (
<ErrorMatcher
title="Failed to load tables"
error={error}
supportFormParams={{ projectRef }}
/>
)}
Key Files
| File | Purpose |
|---|---|
data/error-patterns.ts |
{ pattern, ErrorClass } array — regex lives here |
types/api-errors.ts |
Error classes, KnownErrorType union |
ErrorMatcher.tsx |
Reads errorType, looks up mapping, renders |
error-mappings.tsx |
Record<KnownErrorType, { id, Troubleshooting }> |
Canonical standard: .claude/skills/studio-error-handling/SKILL.md