Extensible Web API middleware that maps all exceptions to standardized RFC7807-compliant HTTP responses.
$ dotnet add package RestExceptionsExtensible Web API middleware that maps all exceptions to standardized REST-compliant error responses.
| RestExceptions Package | NuGet |
|---|---|
| RestExceptions |
// Program.cs
var builder = WebApplication.CreateBuilder(args);
// ...
// Add the service
builder.Services.AddRestExceptions();
var app = builder.Build();
//! Important
app.UseExceptionHandler();
// ...
app.Run();
A minimal API utilizing RestExceptions is included in the project files as an example.
This project was generated using Stratis-Dermanoutsos/dotnet-empty-solution.