error-handling-patterns

Define custom error types, structured logging, and retry mechanisms for codebases.

1|Updated Mar 1, 2026
One-click install
npx skills add https://github.com/hjemmesidekongen/ai --skill error-handling-patterns-hjemmesidekongen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling-patterns
Source: https://github.com/hjemmesidekongen/ai/tree/main/plugins/smedjen/skills/error-handling-patterns
Command: npx skills add https://github.com/hjemmesidekongen/ai --skill error-handling-patterns-hjemmesidekongen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of inconsistent and unhelpful error management in software, ensuring applications can gracefully handle failures and provide clear feedback.

Core Features & Use Cases

  • Standardized Error Types: Implements a hierarchy of custom error classes for domain-specific issues.
  • Structured Logging: Enforces consistent logging formats with essential context for debugging.
  • Retry Strategies: Defines clear rules for retrying operations based on idempotency and error type.
  • Error Boundary Placement: Guides the strategic placement of error boundaries to isolate failures.
  • Use Case: When a user encounters an invalid input during a form submission, the application uses a ValidationError to inform the user precisely what needs correction, rather than crashing or showing a generic error.

Quick Start

Implement custom error classes by extending the base AppError and define specific error types for domain-specific failures.

Frequently Asked Questions about error-handling-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is structured error handling and why do I need it for application resilience?

Structured error handling establishes consistent failure management across codebases by defining custom error types, structured logging, and retry mechanisms. This approach prevents crashes, isolates failures with error boundaries, and provides clear user feedback during invalid input scenarios.

How do I implement custom error types for domain-specific application failures?

To implement custom error types for domain-specific failures, extend a base AppError class to create a hierarchy of specific error classes. This standardizes error management, allowing the application to distinguish between operational and non-operational errors and inform users precisely what needs correction.

What is the best way to define retry strategies for failed operations?

The best way to define retry strategies is by evaluating operation idempotency and error types. Establishing clear rules for retrying operations ensures resilience without duplicating side effects, distinguishing between transient failures eligible for retry and permanent errors requiring immediate user feedback.

When should I place error boundaries to isolate failures in my application?

Error boundaries should be placed strategically across codebases to isolate failures and prevent cascading crashes. Placement should separate operational errors from non-operational errors, ensuring that domain-specific issues like invalid form submissions provide targeted feedback rather than generic application failures.

How does structured logging improve debugging during application failure scenarios?

Structured logging improves debugging by enforcing consistent log formats with essential context during failure scenarios. This standardized logging strategy ensures application errors capture the necessary metadata for resilience tracking and precise root cause analysis across the codebase.

How do I handle invalid user input without crashing the application?

Handle invalid user input by implementing a ValidationError class within a custom error hierarchy. This allows the application to catch the specific domain issue and provide clear feedback informing the user exactly what needs correction, rather than crashing or displaying a generic error.