Initial commit
This commit is contained in:
commit
d9516fa359
50 files changed
+3211
No files matched your search
@@ -0,0 +1,17 @@
|
||||
---
|
||||
description: Consistent error handling — messages, logging, and user feedback
|
||||
globs: **/*.{ts,tsx,js,jsx,py,go,rs}
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Error Handling
|
||||
|
||||
- Never swallow errors silently. Log or re-throw with context.
|
||||
- User-facing errors: clear, actionable messages. No stack traces in production UI.
|
||||
- Internal errors: log full context (request ID, user ID, operation) at appropriate level.
|
||||
- Use typed/custom error classes for domain failures (`NotFoundError`, `ValidationError`).
|
||||
- Validate at the boundary; fail fast with specific field-level messages.
|
||||
- Retry only idempotent operations. Use exponential backoff with a max retry count.
|
||||
- Wrap third-party errors with context: `Failed to send email: ${original.message}`.
|
||||
- HTTP APIs: return correct status codes (400 validation, 401 auth, 403 forbidden, 404 not found, 500 unexpected).
|
||||
- Do not use exceptions for normal control flow.
|
||||
Reference in new issue
Block a user