CrCore.Exceptions.AspNet 10.0.45

Prefix Reserved
dotnet add package CrCore.Exceptions.AspNet --version 10.0.45
                    
NuGet\Install-Package CrCore.Exceptions.AspNet -Version 10.0.45
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CrCore.Exceptions.AspNet" Version="10.0.45" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CrCore.Exceptions.AspNet" Version="10.0.45" />
                    
Directory.Packages.props
<PackageReference Include="CrCore.Exceptions.AspNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CrCore.Exceptions.AspNet --version 10.0.45
                    
#r "nuget: CrCore.Exceptions.AspNet, 10.0.45"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CrCore.Exceptions.AspNet@10.0.45
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CrCore.Exceptions.AspNet&version=10.0.45
                    
Install as a Cake Addin
#tool nuget:?package=CrCore.Exceptions.AspNet&version=10.0.45
                    
Install as a Cake Tool

Intro

ASP.NET Core integration for CrCore.Exceptions.

This package provides automatic handling of CrException instances, converts them into RFC 7807 ProblemDetails responses, and supports configurable exception-to-HTTP status code and log level mappings.

Features

  • ASP.NET Core exception handler
  • RFC 7807 ProblemDetails responses
  • Configurable exception → HTTP status code mapping
  • Configurable exception → log level mapping
  • Generic handling of unexpected exceptions

Installation

builder.Services.AddCrExceptionsCore();

app.UseExceptionHandler();

Default HTTP Status Code Mapping

Exception HTTP Status
ValidationException 400
UnauthorizedException 401
ForbiddenException 403
NotFoundException 404
ConflictException 409
UnprocessableException 422
InternalException 500

Custom HTTP Status Code Mapping

builder.Services.AddCrStatusCodeMapping(builder =>
{
    builder.AddDefaultMappings();

    builder.Map<MyCustomException>(StatusCodes.Status499ClientClosedRequest);
});

Default Log Level Mapping

Exception Log Level
ValidationException Debug
UnauthorizedException Debug
ForbiddenException Debug
NotFoundException Debug
ConflictException Debug
UnprocessableException Debug
InternalException Error

Custom Log Level Mapping

builder.Services.AddCrLogLevelMapping(builder =>
{
    builder.AddDefaultMappings();

    builder.Map<MyCustomException>(LogLevel.Warning);
});

ProblemDetails Response

CrException instances are automatically converted into RFC 7807 ProblemDetails.

Example:

{
  "type": "https://tools.ietf.org/html/rfc9110#section-15.5.5",
  "title": "Not Found",
  "status": 404,
  "errors": [
    {
      "code": "TestNotFoundCode",
      "message": "Test not found message"
    }
  ],
  "traceId": "c771b28502648371f14885924e6d1767"
}

Clients should use errors[].code as the stable application error identifier.


Unexpected Exceptions

Exceptions that do not inherit from CrException are converted into a generic internal server error response.

Example:

{
  "type": "https://tools.ietf.org/html/rfc9110#section-15.6.1",
  "title": "An error occurred while processing your request.",
  "status": 500,
  "errors": [
    {
      "code": "InternalError",
      "message": "An unexpected internal error occurred."
    }
  ],
  "traceId": "9bf8d72774b6f2d97cac7607bb19f408"
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
10.0.45 91 8/7/2026
10.0.44 98 8/5/2026
10.0.43 94 8/3/2026
10.0.42 98 8/1/2026
10.0.41 100 8/1/2026
10.0.40 99 7/30/2026
10.0.33 96 7/27/2026