DSIBT.Library.AspNetCore.ExceptionHandling
1.0.0
dotnet add package DSIBT.Library.AspNetCore.ExceptionHandling --version 1.0.0
NuGet\Install-Package DSIBT.Library.AspNetCore.ExceptionHandling -Version 1.0.0
<PackageReference Include="DSIBT.Library.AspNetCore.ExceptionHandling" Version="1.0.0" />
paket add DSIBT.Library.AspNetCore.ExceptionHandling --version 1.0.0
#r "nuget: DSIBT.Library.AspNetCore.ExceptionHandling, 1.0.0"
// Install DSIBT.Library.AspNetCore.ExceptionHandling as a Cake Addin #addin nuget:?package=DSIBT.Library.AspNetCore.ExceptionHandling&version=1.0.0 // Install DSIBT.Library.AspNetCore.ExceptionHandling as a Cake Tool #tool nuget:?package=DSIBT.Library.AspNetCore.ExceptionHandling&version=1.0.0
Exception Handling
Exception Handling is giving you the opportunity to manage all unhandled exceptions in a single point. By implementing this extension in your WebAPI project, you'll be able to catch all unhandled exceptions and return back a standard exception model as well as you'll be able to provide your own handler method which will be called once any unhandled exception is occured.
Moreover, you can provide different handler for different Exception
types. For instance, HandlerX for ValidationException
or HandlerY for UnAuthorizationException
, and HandlerZ for the rest
Apart from that, you can customize logging by providing an ILogger interface to log the details once the exception is cought by the handler.
UseExceptionDetails
is important because once the default handler is used, it'll return back the exception details.
If UseExceptionDetails
is true, it returns the StackTrace of the Exception.
When it is false, however, it returns the single message ("Internal Server Error Occured!") and 500 StatusCode. So you can use this details in your Dev or PreProd environment but not on production.
On the other hand, logging the details is irrelevant to this parameter. No matter it is true or false, it logs everything with StackTrace.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- Microsoft.AspNetCore.Diagnostics (>= 2.2.0)
- Microsoft.AspNetCore.Http.Extensions (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 3.1.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 205 | 3/6/2023 |