WeNerds.Middlewares
1.0.3
dotnet add package WeNerds.Middlewares --version 1.0.3
NuGet\Install-Package WeNerds.Middlewares -Version 1.0.3
<PackageReference Include="WeNerds.Middlewares" Version="1.0.3" />
<PackageVersion Include="WeNerds.Middlewares" Version="1.0.3" />
<PackageReference Include="WeNerds.Middlewares" />
paket add WeNerds.Middlewares --version 1.0.3
#r "nuget: WeNerds.Middlewares, 1.0.3"
#:package WeNerds.Middlewares@1.0.3
#addin nuget:?package=WeNerds.Middlewares&version=1.0.3
#tool nuget:?package=WeNerds.Middlewares&version=1.0.3
WE Middlewares
Open-source Commons FeatuMiddlewaresres developed to facilitate the creation of a new project in .Net, providing some commons middlewares.
- 👉 Nuget Package -
nuget page
Something is missing? Submit a new
product feature requestusing the issues tracker..
✨ Using the library
👉 Step 1 - Install library into project
- Package Manager
$ Install-Package WeNerds.Middlewares
- .Net CLI
$ dotnet add package WeNerds.Middlewares
👉 Step 2 - Using the Middleware<br> After build the app in the program.cs, call the use method of the middleware:<br>
app.UseExceptionHandlerMiddleware(app.Configuration, app.Environment, app.Logger);
- app.Configuration: Used for get the environment variable
- app.Environment: Used for get the current environment
- app.Logger: Used for log error
✨ About the Middleware
- Exception Handler
This middleware aims to facilitate the handling of exceptions generated in the application. Any exception not handled by the application will be intercepted by this middleware and the following actions will be taken:
Production environment
If the environment variable WN_EXCEPTION_HANDLER_SHOW_LOG_PRODUCTION is true, a log will be generated using the ILogger service (Microsoft.Extensions.Logging).<br> This log contains the ErrorId and the generated exception data,and will be generated following the application's ILogger settings, so it can be generated for AWS, Console and others.<br> The HttpContext Response will not display anything regarding the exception that occurred. Only a Code Message, a Message containing the ErrorId and a StatusCode 500 will be sent to the requester.<br>
If the environment variable WN_EXCEPTION_HANDLER_SHOW_LOG_PRODUCTION is tfalse, the log generation will be ignored and the HttpContext will receive the same response as when the variable is true, but as no log was generated, there will be no way to check the error that occurred.
Development environment
In this case, the HttpContext will receive the detailed error that occurred, thus not needing to generate logs
Important <br> The environment variable WN_EXCEPTION_HANDLER_SHOW_LOG_PRODUCTION, can be created at appSettings.json or at environment variable of the Operational System.
✨ Contacts
📧 Email - leo.cavalheiro.ti@gmail.com
| 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.AspNetCore.Diagnostics.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- WeNerds.Services (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.