Cayaqui.BuildingBlocks.AspNetCore
0.4.21
dotnet add package Cayaqui.BuildingBlocks.AspNetCore --version 0.4.21
NuGet\Install-Package Cayaqui.BuildingBlocks.AspNetCore -Version 0.4.21
<PackageReference Include="Cayaqui.BuildingBlocks.AspNetCore" Version="0.4.21" />
<PackageVersion Include="Cayaqui.BuildingBlocks.AspNetCore" Version="0.4.21" />
<PackageReference Include="Cayaqui.BuildingBlocks.AspNetCore" />
paket add Cayaqui.BuildingBlocks.AspNetCore --version 0.4.21
#r "nuget: Cayaqui.BuildingBlocks.AspNetCore, 0.4.21"
#:package Cayaqui.BuildingBlocks.AspNetCore@0.4.21
#addin nuget:?package=Cayaqui.BuildingBlocks.AspNetCore&version=0.4.21
#tool nuget:?package=Cayaqui.BuildingBlocks.AspNetCore&version=0.4.21
Cayaqui.BuildingBlocks.AspNetCore
ASP.NET Core companion for Cayaqui.BuildingBlocks: mapea Result<T>/DomainError
a RFC 7807 ProblemDetails por ErrorType, proporciona un IExceptionHandler global
(500 + traceId) y el método de extensión AddCayaquiErrorHandling.
Contenido
| Tipo | Función |
|---|---|
ProblemDetailsMapper |
StatusFor(ErrorType), ToProblemDetails(DomainError), Result<T>.ToHttpResult() |
GlobalExceptionHandler |
DomainRuleException → ProblemDetails por ErrorType (409/400/404…); el resto → 500 + traceId |
AddCayaquiErrorHandling |
Registra AddProblemDetails + AddExceptionHandler<GlobalExceptionHandler> |
Setup
// Program.cs
builder.Services.AddCayaquiErrorHandling();
var app = builder.Build();
app.UseExceptionHandler();
app.UseStatusCodePages();
Mapa ErrorType → HTTP
| ErrorType | Status |
|---|---|
Validation |
400 |
Unauthorized |
401 |
Forbidden |
403 |
NotFound |
404 |
Conflict |
409 |
Concurrency |
409 |
Unexpected |
500 |
Uso en Minimal API / Controller
app.MapGet("/projects/{id}", async (Guid id, IProjectService svc) =>
{
var result = await svc.GetAsync(id);
return result.ToHttpResult();
});
ToHttpResult() retorna 200 OK con el valor si IsSuccess, o un ProblemDetails
con el status correspondiente al ErrorType si IsFailure.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Cayaqui.BuildingBlocks (>= 0.4.21)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.4.21 | 103 | 6/23/2026 |
| 0.4.20 | 100 | 6/23/2026 |
| 0.4.15 | 102 | 6/22/2026 |
| 0.4.14 | 97 | 6/22/2026 |
| 0.4.13 | 112 | 6/22/2026 |
| 0.4.10 | 106 | 6/20/2026 |
| 0.4.5 | 102 | 6/20/2026 |
| 0.4.3 | 94 | 6/20/2026 |
| 0.4.2 | 97 | 6/20/2026 |
| 0.4.1 | 97 | 6/20/2026 |
| 0.3.9 | 101 | 6/19/2026 |
| 0.3.8 | 99 | 6/18/2026 |
| 0.3.7 | 100 | 6/18/2026 |
| 0.3.6 | 109 | 6/18/2026 |
| 0.3.5 | 106 | 6/18/2026 |
| 0.3.4 | 97 | 6/17/2026 |
| 0.1.2 | 105 | 6/16/2026 |
| 0.1.1 | 102 | 6/16/2026 |
| 0.1.0 | 102 | 6/15/2026 |
0.1.1 — GlobalExceptionHandler ahora mapea DomainRuleException (BuildingBlocks 0.4.1) a ProblemDetails por ErrorType (Conflict→409, Validation→400, NotFound→404…) y la loguea a Debug (rechazo de negocio esperado, no 500). El resto de excepciones sigue → 500 + traceId. 0.1.0 — Initial release: ProblemDetailsMapper (ErrorType→HTTP status, DomainError→ProblemDetails, Result<T>.ToHttpResult()), GlobalExceptionHandler (unhandled exception → 500 + traceId) and AddMpsErrorHandling DI extension.