Pavalisoft.ExceptionHandling
1.0.0
dotnet add package Pavalisoft.ExceptionHandling --version 1.0.0
NuGet\Install-Package Pavalisoft.ExceptionHandling -Version 1.0.0
<PackageReference Include="Pavalisoft.ExceptionHandling" Version="1.0.0" />
paket add Pavalisoft.ExceptionHandling --version 1.0.0
#r "nuget: Pavalisoft.ExceptionHandling, 1.0.0"
// Install Pavalisoft.ExceptionHandling as a Cake Addin #addin nuget:?package=Pavalisoft.ExceptionHandling&version=1.0.0 // Install Pavalisoft.ExceptionHandling as a Cake Tool #tool nuget:?package=Pavalisoft.ExceptionHandling&version=1.0.0
Exception Handling
Pavalisoft.ExceptionHandling is an open source ASP.NET Core global exception handler extension complaint with .NET Standard 2.0 written in C#, which provides ExceptionFilter and ExceptionHandlingMiddleware APIs.
The main goal of the Pavalisoft.ExceptionHandling package is to make developer's life easier to handle exceptions handling scenarios at single place and concentrate on functionality. It's additional feature ExceptionManager and inbuilt ExceptionHandlers
supports various exception handling mechanisms with configurable ExceptionSettings
By default, Pavalisoft.ExceptionHandling also supports exceptions logging and exception messages localization through ExceptionSettings configuration.
ExceptionRaiser supports to raise the exceptions from the code wherever required which should be handled through ExceptionManager using ErrorDetail.
Provides inbuilt ObjectResult
and ViewResult
specific creators and result handlers to create HttpResponseMessage
s for WebApi and WebApp implementations. While creating the ViewResult
for the handled exception, the ViewResult
creators takes the the Error ViewName
from ErrorDetail.ViewName
from ExceptionSettings. The ExceptionData object will be returned in ObjectResult
as json content and will be returned its properties/attributes as ViewData
in ViewResult
to the ErrorDetail.ViewName
view.
Documentation & Samples
Complete Documentation is available at https://pavalisoft.github.io/ExceptionHandling/ for Pavalisoft.ExceptionHandling API
Refer https://github.com/pavalisoft/ExceptionHandling/tree/master/Samples for reference implementations
- Pavalisoft.ExceptionHandling.Sample - Console application :
ExceptionHandlingMiddleware
withObjectResultCreator
,ObjectResultHandler
, Application specificExceptionCodesDecider
,ExceptionSettings
in appsettings.json, exceptions logging and exception messages localization. - Pavalisoft.ExceptionHandling.NoConfigSample - Console application :
ExceptionHandlingMiddleware
withObjectResultCreator
,ObjectResultHandler
, Application specificExceptionCodesDecider
,ExceptionSettings
object creation in Program.cs, exceptions logging and exception messages localization. - Pavalisoft.ExceptionHandling.FilterSample - ASP.NET Core MVC WebApp :
ExceptionFilter
withViewResultCreator
,ViewResultHandler
, Application specificExceptionCodesDecider
,ExceptionSettings
in appsettings.json, exceptions logging and exception messages localization. - Pavalisoft.ExceptionHandling.RestFilterSample - ASP.NET Core MVC WebApi :
ExceptionFilter
withObjectResultCreator
,ObjectResultHandler
, Application specificExceptionCodesDecider
,ExceptionSettings
in appsettings.json, exceptions logging and exception messages localization. - Pavalisoft.ExceptionHandling.MiddlewareSample - ASP.NET Core MVC WebApp :
ExceptionHandlingMiddleware
withViewResultCreator
,ViewResultHandler
, Application specificExceptionCodesDecider
,ExceptionSettings
in appsettings.json, exceptions logging and exception messages localization. - Pavalisoft.ExceptionHandling.RestMiddlewareSample - ASP.NET Core MVC WebApi :
ExceptionHandlingMiddleware
withObjectResultCreator
,ObjectResultHandler
, Application specificExceptionCodesDecider
,ExceptionSettings
in appsettings.json, exceptions logging and exception messages localization.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.AspNetCore.Diagnostics (>= 2.2.0)
- Microsoft.AspNetCore.Mvc.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Mvc.ViewFeatures (>= 2.2.0)
- Microsoft.Extensions.Logging (>= 2.2.0)
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 | 543 | 7/3/2019 |
Pavalisoft.ExceptionHandling is an open source exception handler extension for .NET Standard written in C#, which provides single unified API to handle both ASP.NET Core and ASP.NET Core MVC Exceptions with
- Exceptions Logging
- Exceptions Messages Localization
- Extensible ActionResult creators for both WebApp and WebApi (REST)
- Extensible ActionResult handlers to handle/intercept post creation of ActionResult for both WebApp and WebApi (REST)
- ExceptionCodesDecider to specify the error details code to be picked up for the application level Exceptions
Provides the below inbuild Exception Handlers
- WrapExceptionHandler : Wraps the original Exception with the Wrap Error message specified in ErrorDetail and creates ActionResult
- DefaultExceptionHandler: Creates the ActionResult for the exception raised using supplied ErrorDetail.
This Api provides ExceptionFilter and ExceptionHandlingMiddleware.
- ExceptionFilter : Hanldes the exception raised in ASP.NET Core MVC middleware in Filters pipeline
- ExceptionHandlingMiddleware: Handles including the exceptions raised in ASP.NET core pipeline as well.
Refer the below Sample Projects from https://github.com/Pavalisoft/ExceptionHandling for reference implementation and https://pavalisoft.github.io/ExceptionHandling/ for API Documentation