← ClaudeAtlas

error-handlinglisted

Use when implementing structured error handling in backend or frontend code. Triggers for: try-catch patterns, custom exception classes, global error handlers, error logging, user-friendly error messages, or API error responses. NOT for: business logic validation (use domain exceptions) or unrelated error types.
aiskillstore/marketplace · ★ 329 · Web & Frontend · score 79
Install: claude install-skill aiskillstore/marketplace
# Error Handling Skill Expert structured error handling for FastAPI backends and React/Next.js frontends with consistent error messages and logging. ## Quick Reference | Pattern | Backend | Frontend | |---------|---------|----------| | Custom exception | `class FeeNotPaidError(AppException)` | N/A | | Try-catch | `try: ... except SpecificError:` | `try { } catch (e) { }` | | Global handler | `@app.exception_handler` | `ErrorBoundary` component | | User message | `detail` field in response | Toast/Snackbar | | Error logging | `logger.error(...)` | Console/Sentry | ## Custom Exceptions (Backend) ### Base Exception Hierarchy ```python # backend/app/errors/exceptions.py from fastapi import HTTPException from typing import Any class AppException(HTTPException): """Base application exception with user-friendly messages.""" def __init__( self, status_code: int, detail: str, user_message: str, headers: dict[str, Any] | None = None, ): self.user_message = user_message super().__init__(status_code=status_code, detail=detail, headers=headers) class NotFoundError(AppException): """Resource not found (404).""" def __init__(self, resource: str, identifier: str): super().__init__( status_code=404, detail=f"{resource} with id '{identifier}' not found", user_message=f"{resource} not found. Please check and try again.", ) class ValidationError(AppExcepti