Kck.Exceptions.Abstractions 4.7.0

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Kck.Exceptions.Abstractions --version 4.7.0
                    
NuGet\Install-Package Kck.Exceptions.Abstractions -Version 4.7.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kck.Exceptions.Abstractions" Version="4.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kck.Exceptions.Abstractions" Version="4.7.0" />
                    
Directory.Packages.props
<PackageReference Include="Kck.Exceptions.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Kck.Exceptions.Abstractions --version 4.7.0
                    
#r "nuget: Kck.Exceptions.Abstractions, 4.7.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Kck.Exceptions.Abstractions@4.7.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Kck.Exceptions.Abstractions&version=4.7.0
                    
Install as a Cake Addin
#tool nuget:?package=Kck.Exceptions.Abstractions&version=4.7.0
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last Updated
4.8.0 192 10/31/2026
Loading failed