CodeNet Exception Handler package.
License
—
Deps
2
Install Size
—
Vulns
✓ 0
Published
Aug 18, 2025
$ dotnet add package CodeNet.ExceptionHandlingCodeNet.ExceptionHandling is a .Net library.
Use the package manager npm to install CodeNet.ExceptionHandling
dotnet add package CodeNet.ExceptionHandling
appSettings.json
{
"DefaultErrorMessage": {
"MessageCode": "EX0001",
"Message": "An unexpected error occurred!"
}
}
program.cs
using CodeNet.ExceptionHandling.Extensions;
var builder = WebApplication.CreateBuilder(args);
builder.AddDefaultErrorMessage(builder.Configuration.GetSection("DefaultErrorMessage"));
//...
var app = builder.Build();
//...
app.UseExceptionHandling(); //This should be used last.
app.Run();
Example Error Message
{
"Detail": "Default message details",
"Title": "Default message title",
"Status": 500
}