JG.ErrorKit 1.0.0

dotnet add package JG.ErrorKit --version 1.0.0
                    
NuGet\Install-Package JG.ErrorKit -Version 1.0.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="JG.ErrorKit" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JG.ErrorKit" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="JG.ErrorKit" />
                    
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 JG.ErrorKit --version 1.0.0
                    
#r "nuget: JG.ErrorKit, 1.0.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 JG.ErrorKit@1.0.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=JG.ErrorKit&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=JG.ErrorKit&version=1.0.0
                    
Install as a Cake Tool

dotnet-error-kit

NuGet Downloads License CI


A structured error handling framework for .NET that replaces scattered exception patterns with typed, context-rich errors. Built around RFC 7807 Problem Details, with error codes, context chains, severity levels, global error hooks, a Result pattern for explicit error handling, and an exception bridge for boundary crossing.

Features

  • Typed Errors — Define application-specific error types with codes, severity, and metadata
  • Context Chains — Wrap errors with additional context as they propagate up the call stack
  • RFC 7807 Problem Details — Automatic serialization to standard Problem Details JSON for API responses
  • Error Codes — Centralized error code registry with documentation URLs and categorization
  • Severity Levels — Classify errors as Info, Warning, Error, Critical, or Fatal
  • Global Hooks — Register error handlers that fire on any error (logging, telemetry, alerting)
  • Result PatternResult<T> type for explicit error handling without exceptions
  • Exception Bridge — Convert between typed errors and exceptions when crossing boundaries

Installation

dotnet add package JG.ErrorKit

Quick Start

// Define application errors
public class UserErrors : ErrorCategory
{
    public static readonly ErrorCode NotFound = new("USER_001", "User not found");
    public static readonly ErrorCode InvalidEmail = new("USER_002", "Invalid email format");
}

// Return typed results
public Result<User> GetUser(string id)
{
    var user = _repo.Find(id);
    if (user is null)
        return AppError.From(UserErrors.NotFound).WithContext("id", id);

    return user;
}

Getting Started

  • Define error codes and register them with services.AddErrorKit(...).
  • Return typed results for predictable error handling.
  • Publish errors to observers for logging or telemetry.
  • Map to RFC 7807 Problem Details when returning API responses.

See Getting Started for full walkthroughs.

Documentation

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

Licensed under the Apache License 2.0. See LICENSE for details.


Ready to get started? Install via NuGet and check out the API reference.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.

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
1.0.0 90 2/23/2026