Pavalisoft.ExceptionHandling 1.0.0

Pavalisoft.ExceptionHandling is an open source exception handler extension for .NET Standard written in C#, which provides single unified API to handle both .NET Core and ASP.NET Core Exceptions at Single place

Install-Package Pavalisoft.ExceptionHandling -Version 1.0.0
dotnet add package Pavalisoft.ExceptionHandling --version 1.0.0
<PackageReference Include="Pavalisoft.ExceptionHandling" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pavalisoft.ExceptionHandling --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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 HttpResponseMessages 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.ViewNameview.

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 with ObjectResultCreator, ObjectResultHandler, Application specific ExceptionCodesDecider, ExceptionSettings in appsettings.json, exceptions logging and exception messages localization.
  • Pavalisoft.ExceptionHandling.NoConfigSample - Console application : ExceptionHandlingMiddleware with ObjectResultCreator, ObjectResultHandler, Application specific ExceptionCodesDecider, ExceptionSettings object creation in Program.cs, exceptions logging and exception messages localization.
  • Pavalisoft.ExceptionHandling.FilterSample - ASP.NET Core MVC WebApp : ExceptionFilter with ViewResultCreator, ViewResultHandler, Application specific ExceptionCodesDecider, ExceptionSettings in appsettings.json, exceptions logging and exception messages localization.
  • Pavalisoft.ExceptionHandling.RestFilterSample - ASP.NET Core MVC WebApi : ExceptionFilter with ObjectResultCreator, ObjectResultHandler, Application specific ExceptionCodesDecider, ExceptionSettings in appsettings.json, exceptions logging and exception messages localization.
  • Pavalisoft.ExceptionHandling.MiddlewareSample - ASP.NET Core MVC WebApp : ExceptionHandlingMiddleware with ViewResultCreator, ViewResultHandler, Application specific ExceptionCodesDecider, ExceptionSettings in appsettings.json, exceptions logging and exception messages localization.
  • Pavalisoft.ExceptionHandling.RestMiddlewareSample - ASP.NET Core MVC WebApi : ExceptionHandlingMiddleware with ObjectResultCreator, ObjectResultHandler, Application specific ExceptionCodesDecider, ExceptionSettings in appsettings.json, exceptions logging and exception messages localization.

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 HttpResponseMessages 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.ViewNameview.

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 with ObjectResultCreator, ObjectResultHandler, Application specific ExceptionCodesDecider, ExceptionSettings in appsettings.json, exceptions logging and exception messages localization.
  • Pavalisoft.ExceptionHandling.NoConfigSample - Console application : ExceptionHandlingMiddleware with ObjectResultCreator, ObjectResultHandler, Application specific ExceptionCodesDecider, ExceptionSettings object creation in Program.cs, exceptions logging and exception messages localization.
  • Pavalisoft.ExceptionHandling.FilterSample - ASP.NET Core MVC WebApp : ExceptionFilter with ViewResultCreator, ViewResultHandler, Application specific ExceptionCodesDecider, ExceptionSettings in appsettings.json, exceptions logging and exception messages localization.
  • Pavalisoft.ExceptionHandling.RestFilterSample - ASP.NET Core MVC WebApi : ExceptionFilter with ObjectResultCreator, ObjectResultHandler, Application specific ExceptionCodesDecider, ExceptionSettings in appsettings.json, exceptions logging and exception messages localization.
  • Pavalisoft.ExceptionHandling.MiddlewareSample - ASP.NET Core MVC WebApp : ExceptionHandlingMiddleware with ViewResultCreator, ViewResultHandler, Application specific ExceptionCodesDecider, ExceptionSettings in appsettings.json, exceptions logging and exception messages localization.
  • Pavalisoft.ExceptionHandling.RestMiddlewareSample - ASP.NET Core MVC WebApi : ExceptionHandlingMiddleware with ObjectResultCreator, ObjectResultHandler, Application specific ExceptionCodesDecider, ExceptionSettings in appsettings.json, exceptions logging and exception messages localization.

Release Notes

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

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 56 7/3/2019