JG.ErrorKit
1.0.0
dotnet add package JG.ErrorKit --version 1.0.0
NuGet\Install-Package JG.ErrorKit -Version 1.0.0
<PackageReference Include="JG.ErrorKit" Version="1.0.0" />
<PackageVersion Include="JG.ErrorKit" Version="1.0.0" />
<PackageReference Include="JG.ErrorKit" />
paket add JG.ErrorKit --version 1.0.0
#r "nuget: JG.ErrorKit, 1.0.0"
#:package JG.ErrorKit@1.0.0
#addin nuget:?package=JG.ErrorKit&version=1.0.0
#tool nuget:?package=JG.ErrorKit&version=1.0.0
dotnet-error-kit
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 Pattern —
Result<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
- API Reference — Full API documentation and examples
- Getting Started — Setup guide and common workflows
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 | Versions 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. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
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 |