error-handling-patterns

Provide cross-language error handling patterns for .NET and TypeScript applications.

24|5|Updated Nov 28, 2025
One-click install
npx skills add https://github.com/thapaliyabikendra/ai-artifacts --skill error-handling-patterns-thapaliyabikendra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling-patterns
Source: https://github.com/thapaliyabikendra/ai-artifacts/tree/main/.claude/skills/error-handling-patterns
Command: npx skills add https://github.com/thapaliyabikendra/ai-artifacts --skill error-handling-patterns-thapaliyabikendra

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive error handling patterns across multiple languages, helping you build resilient and reliable applications. It addresses common issues like unhandled exceptions, inconsistent error responses, and cascading failures, ensuring your systems can gracefully recover from unexpected events.

Core Features & Use Cases

  • Exception & Result Types: Guides on using custom exception hierarchies for unexpected errors and Result types for expected, recoverable failures, promoting clear error communication.
  • Polly Resilience Policies: Demonstrates how to implement retry with exponential backoff, circuit breakers, and fallbacks using Polly for external service calls and database operations.
  • Graceful Degradation: Patterns for ensuring core functionality remains available even when non-critical services fail, improving user experience during outages.
  • Use Case: A backend developer integrates with a third-party API that is occasionally unreliable. Using this skill, they implement a Polly policy with retry, circuit breaker, and fallback mechanisms to ensure their application remains stable and responsive despite external service fluctuations.

Quick Start

Implement a C# Result type for a function that parses JSON, returning either a successful object or a SyntaxError.

Frequently Asked Questions about error-handling-patterns

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

FAQPage Schema
How do I implement error handling patterns for resilient applications?

Error handling patterns provide structured approaches using custom exceptions, Result types, and Polly resilience policies to handle both unexpected errors and expected failures. Implement custom exception hierarchies for exceptional cases, Result types for recoverable failures, and Polly policies with retry, circuit breaker, and fallback mechanisms to ensure applications recover gracefully from service disruptions.

What's the difference between exceptions and Result types in error handling?

Exceptions represent unexpected, exceptional conditions that interrupt normal flow; Result types represent expected, recoverable failures as values. Use exceptions for truly exceptional scenarios and custom exception hierarchies for domain-specific errors. Use Result types to model operations that may predictably fail, promoting explicit error handling and clearer API contracts.

How do I use Polly for retry, circuit breaker, and fallback patterns?

Polly resilience policies automate recovery logic for external service calls and database operations. Define retry policies with exponential backoff to handle transient failures, circuit breakers to prevent cascading failures, and fallback mechanisms to provide alternative responses. Combine these policies to build stable applications that degrade gracefully when dependencies become unreliable.

Can I implement error handling patterns in both .NET and TypeScript?

Error handling patterns apply across .NET (C#) and TypeScript environments, though implementations differ by language. Use custom exception hierarchies and Result types in both; Polly is .NET-specific, but TypeScript has equivalent resilience libraries. The underlying principles—retry logic, circuit breakers, and graceful degradation—translate across both platforms.

What is graceful degradation and when should I use it?

Graceful degradation ensures core functionality remains available when non-critical services fail, improving user experience during outages. Implement fallback responses, cached data, or reduced feature sets when dependencies are unavailable. Use this pattern for background processing, API integrations, and service meshes where partial availability is preferable to complete failure.

How do I handle errors in API design and service integration?

Consistent error handling in API design uses custom exception hierarchies, Result type wrappers, and observability to communicate failures predictably. For service integration, apply Polly policies to external API calls, implement circuit breakers to prevent cascading failures, and define fallback behaviors. This ensures client applications can robustly handle integration failures.