error-handling-patterns
Implementar Patrones Robustos de Manejo de Errores
También disponible en: wshobson
Construye aplicaciones más resilientes dominando patrones de manejo de errores incluyendo excepciones, tipos Result, lógica de reintentos y circuit breakers en Python, TypeScript, Rust y Go.
Descargar el ZIP de la skill
Subir en Claude
Ve a Configuración → Capacidades → Skills → Subir skill
Activa y empieza a usar
Pruébalo
Usando "error-handling-patterns". How do I handle errors when calling an external API?
Resultado esperado:
For external API calls, implement multiple layers of error handling: (1) Custom exception hierarchy for different failure types, (2) Retry with exponential backoff for transient errors, (3) Circuit breaker to prevent cascading failures, (4) Graceful degradation with fallback data. Example approach: Create custom exceptions (NetworkError, TimeoutError, RateLimitError), wrap API calls in retry decorator with 3 attempts and exponential backoff, use circuit breaker to track failure rates, provide cached fallback when API is unavailable.
Usando "error-handling-patterns". When should I use Result types instead of exceptions?
Resultado esperado:
Use Result types for expected failures (validation errors, not found errors, business logic errors) where the caller should explicitly handle both success and failure cases. Use exceptions for truly exceptional situations (null pointers, out of memory, unexpected runtime errors). Result types make error handling explicit in the type system, forcing callers to consider failure cases. In TypeScript, Result<T, E> = { ok: true, value: T } | { ok: false, error: E }. In Rust, the ? operator and Result<T, E> type provide built-in support. This approach improves code readability and reduces unexpected runtime errors.
Auditoría de seguridad
SeguroThis skill is a documentation and educational resource about error handling patterns. The static scanner flagged 49 potential issues, but after evaluation all findings are FALSE POSITIVES. The detected patterns (backtick syntax examples, HTTP library examples, error categories) are educational code snippets in markdown documentation, not executable malicious code. No security concerns identified.
Puntuación de calidad
Lo que puedes crear
Mejorar la Confiabilidad de Aplicaciones
Agrega manejo de errores robusto a características nuevas o existentes con jerarquías de excepciones adecuadas y mensajes de error significativos.
Construir Sistemas Tolerantes a Fallos
Implementa lógica de reintentos, circuit breakers y degradación elegante para sistemas distribuidos y microservicios.
Aprender Patrones Multi-Idioma
Comprende enfoques de manejo de errores en Python, TypeScript, Rust y Go para elegir el mejor enfoque para cada situación.
Prueba estos prompts
Help me implement proper error handling for a function that fetches user data from a database. I want to create custom exception classes and handle different error scenarios appropriately.
Show me how to implement a Result type pattern in TypeScript for parsing JSON data. Include proper error types and chainable error handling.
Create a Python decorator that implements retry logic with exponential backoff for network calls. Handle different exception types and include configurable attempts.
Implement a circuit breaker pattern in Python to prevent cascading failures when calling an external API. Include closed, open, and half-open states.
Mejores prácticas
- Fail fast by validating input early and providing meaningful error messages with context
- Preserve error context including stack traces, timestamps, and relevant metadata
- Handle errors at the appropriate level where you can meaningfully respond to them
- Log errors appropriately - log unexpected errors, not expected validation failures
Evitar
- Catching too broadly with generic Exception handlers that hide bugs
- Empty catch blocks that silently swallow errors without logging or handling
- Returning error codes instead of using proper exceptions or Result types
- Ignoring async errors by not handling promise rejections properly
Preguntas frecuentes
What is the difference between exceptions and Result types?
When should I use a circuit breaker?
How does exponential backoff work for retries?
What is graceful degradation?
Should I catch exceptions or let them propagate?
How do I create meaningful error messages?
Detalles del desarrollador
Autor
sickn33Licencia
MIT
Repositorio
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/error-handling-patternsRef.
main
Estructura de archivos