DriDrood.ErrorHandling.Asp
1.1.1
dotnet add package DriDrood.ErrorHandling.Asp --version 1.1.1
NuGet\Install-Package DriDrood.ErrorHandling.Asp -Version 1.1.1
<PackageReference Include="DriDrood.ErrorHandling.Asp" Version="1.1.1" />
<PackageVersion Include="DriDrood.ErrorHandling.Asp" Version="1.1.1" />
<PackageReference Include="DriDrood.ErrorHandling.Asp" />
paket add DriDrood.ErrorHandling.Asp --version 1.1.1
#r "nuget: DriDrood.ErrorHandling.Asp, 1.1.1"
#:package DriDrood.ErrorHandling.Asp@1.1.1
#addin nuget:?package=DriDrood.ErrorHandling.Asp&version=1.1.1
#tool nuget:?package=DriDrood.ErrorHandling.Asp&version=1.1.1
Error handling
Lightweight tool for clean error rising and catching. Unifies all errors - user input and system.
Installation
To install this nuGet package, open console in folder with your project and run:
dotnet add package DriDrood.ErrorHandling
For ASP.NET application run:
dotnet add package DriDrood.ErrorHandling.Asp
Using
ASP.NET application
Update your Program.cs
to return new error structure.
Add validation filter:
builder.Services.AddControllers(opt => {
opt.Filters.Add<DriDrood.ErrorHandling.Asp.ValidationFilter>();
});
Use ExceptionMiddleware as your first middleware (or second, if you are using any logging middleware):
app.UseMiddleware<DriDrood.ErrorHandling.Asp.ExceptionMiddleware>();
Now you can throw DriDrood.ErrorHandling.Asp.UserInputException anywhere in your app and it will return in a same way as any other error.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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. |
-
net9.0
- DriDrood.ErrorHandling (>= 1.1.1)
- Microsoft.AspNetCore.Http (>= 2.3.0)
- Microsoft.AspNetCore.Mvc (>= 2.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.