Skip to content

ErrorLens.ErrorHandlingProduction-Ready Error Handling for ASP.NET Core

Transform unhandled exceptions into clean, structured JSON responses with minimal setup — just two lines of code to get started.

ErrorLens

Quick Start

bash
dotnet add package ErrorLens.ErrorHandling
csharp
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddErrorHandling();

var app = builder.Build();
app.UseErrorHandling();
app.Run();

Any unhandled exception automatically becomes a structured JSON response:

json
{
  "code": "USER_NOT_FOUND",
  "message": "Could not find user with id 123"
}

Packages

PackageTargetNuGet
ErrorLens.ErrorHandling.NET 6 - 10NuGet
ErrorLens.ErrorHandling.OpenApi.NET 9+NuGet
ErrorLens.ErrorHandling.Swashbuckle.NET 6 - 8NuGet
ErrorLens.ErrorHandling.FluentValidation.NET 6 - 10NuGet

Released under the MIT License.