cck-error-handling
CommunityConsistent API error handling for .NET
Software Engineering#error-handling#aspnetcore#fluentvalidation#mediatr#problemdetails#ardalis.result#global-exception-middleware
Authors205109
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Provides a consistent, production-ready approach to representing expected failures and unexpected errors in ASP.NET APIs so controllers return uniform, machine-readable error responses instead of ad-hoc strings or thrown exceptions.
Core Features & Use Cases
- Uses Ardalis.Result to model typed outcomes (Success, NotFound, Invalid, Conflict, Error) so handlers avoid throwing for expected flow control.
- Enforces request validation via a MediatR ValidationBehavior with FluentValidation to ensure handlers only receive valid requests.
- Maps domain results to HTTP automatically using result.ToActionResult in controllers and returns ProblemDetails (RFC 9457) for API errors.
- Provides a GlobalExceptionMiddleware to log unhandled exceptions and return RFC-compliant ProblemDetails 500 responses.
- Use case: build CRUD endpoints that return consistent status codes for not-found, validation errors, conflicts, and unexpected server faults.
Quick Start
Return typed Ardalis.Result from handlers, register ValidationBehavior and FluentValidation in DI, and map responses in controllers using result.ToActionResult(this).
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: cck-error-handling Download link: https://github.com/s205109/AHKFlowApp/archive/main.zip#cck-error-handling Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.