Skip to content

LeonidEfremov/aspnet.webapi.exceptions.mapper

Repository files navigation

AspNet.WebApi.Exceptions.Mapper

NuGet Version Build Status SonarQube Coverage Libraries.io dependency status License

About

Exception Mapper allow to map some Exception to ApiException and treat them in a certain way.

Usage

public void ConfigureServices(IServiceCollection services)
{
    services.AddExceptionMapper(options =>
    {
        options.Map<System.ArgumentException, BadRequestException>();
        options.Map<System.NullReferenceException, ApiException>();
    });
}

Requirements

Only .NET Core SDK (2.2.0 and above) required.