Kck.Exceptions.Abstractions
4.7.0
See the version list below for details.
dotnet add package Kck.Exceptions.Abstractions --version 4.7.0
NuGet\Install-Package Kck.Exceptions.Abstractions -Version 4.7.0
<PackageReference Include="Kck.Exceptions.Abstractions" Version="4.7.0" />
<PackageVersion Include="Kck.Exceptions.Abstractions" Version="4.7.0" />
<PackageReference Include="Kck.Exceptions.Abstractions" />
paket add Kck.Exceptions.Abstractions --version 4.7.0
#r "nuget: Kck.Exceptions.Abstractions, 4.7.0"
#:package Kck.Exceptions.Abstractions@4.7.0
#addin nuget:?package=Kck.Exceptions.Abstractions&version=4.7.0
#tool nuget:?package=Kck.Exceptions.Abstractions&version=4.7.0
Kck.Exceptions.Abstractions
Structured HTTP-aware exception hierarchy — CustomException base with concrete types that map automatically to HTTP status codes via [HttpStatusCode] attribute.
Installation
dotnet add package Kck.Exceptions.Abstractions
Quick Start
using Kck.Exceptions;
// Throw typed exceptions in the domain/application layer
public class OrderService(IOrderStore orders, IPermissionChecker permissions)
{
public async Task<Order> GetOrderAsync(Guid id, CancellationToken ct) =>
await orders.FindAsync(id, ct) ?? throw new NotFoundException($"Order {id} was not found.");
public async Task UpdateOrderAsync(Guid userId, Order order, CancellationToken ct)
{
if (order.Total <= 0)
throw new BadRequestException("Order total must be greater than zero.");
if (!await permissions.HasPermissionAsync(userId, "orders.write", ct))
throw new ForbiddenException("You do not have permission to update orders.");
}
}
public interface IOrderStore
{
Task<Order?> FindAsync(Guid id, CancellationToken ct);
}
public interface IPermissionChecker
{
Task<bool> HasPermissionAsync(Guid userId, string permission, CancellationToken ct);
}
// The exception middleware (Kck.Exceptions.AspNetCore) catches these and returns the matching status code:
// NotFoundException 404, BadRequestException 400, ForbiddenException 403.
Configuration
This is a contracts-only package — no configuration required. Pair with Kck.Exceptions.AspNetCore for automatic HTTP mapping in ASP.NET Core.
Resources
| 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
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Kck.Exceptions.Abstractions:
| Package | Downloads |
|---|---|
|
Kck.Exceptions.AspNetCore
ASP.NET Core global exception handler for Kck exceptions. Maps Kck exception types to RFC 7807 ProblemDetails responses with correct HTTP status codes via [HttpStatusCodeAttribute]. Registered via AddKckExceptionHandling(). |
|
|
Kck.Pipeline.Mediator
Mediator.Abstractions 3.x-backed pipeline behaviors for Kck. Provides Authorization, Caching, Logging, Transaction, and Validation cross-cutting behaviors. The recommended pipeline provider since Kck v2. Registered via AddKckMediator(). |
GitHub repositories
This package is not used by any popular GitHub repositories.