JorgeCostaMacia.Exception 6.0.4

Prefix Reserved
dotnet add package JorgeCostaMacia.Exception --version 6.0.4
                    
NuGet\Install-Package JorgeCostaMacia.Exception -Version 6.0.4
                    
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="JorgeCostaMacia.Exception" Version="6.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JorgeCostaMacia.Exception" Version="6.0.4" />
                    
Directory.Packages.props
<PackageReference Include="JorgeCostaMacia.Exception" />
                    
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 JorgeCostaMacia.Exception --version 6.0.4
                    
#r "nuget: JorgeCostaMacia.Exception, 6.0.4"
                    
#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 JorgeCostaMacia.Exception@6.0.4
                    
#: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=JorgeCostaMacia.Exception&version=6.0.4
                    
Install as a Cake Addin
#tool nuget:?package=JorgeCostaMacia.Exception&version=6.0.4
                    
Install as a Cake Tool

JorgeCostaMacia.Exception

A small hierarchy of domain exceptions carrying traceable metadata — a stable id, type name, error code, HTTP status code and UTC timestamp — for consistent logging, correlation and API error mapping.

NuGet Downloads Build License


Install

dotnet add package JorgeCostaMacia.Exception

Types

All are abstract — inherit them in your bounded context to create concrete, named exceptions.

Type For Default HTTP
DomainException base of the hierarchy 500
ErrorException one or more general business errors (Errors) 400
ExistException resource already exists / conflict 409
NotFoundException resource not found 404
ValidationException validation failures (Validations) 400

Usage

using JorgeCostaMacia.Exception.Domain;

public sealed class CustomerNotFoundException(Guid customerId)
    : NotFoundException(null, null, null, null, null, $"Customer {customerId} was not found.", null);

// every null falls back to a default: AggregateId (UUIDv7 via GuidFactory),
// AggregateType (the NotFoundException full name), AggregateCode,
// AggregateHttpCode (404), AggregateOccurredAt (UTC now).

ValidationException carries a list of FluentValidation.Results.ValidationFailure, so it plugs straight into a FluentValidation AbstractValidator:

protected override void RaiseValidationException(ValidationContext<T> context, ValidationResult result)
    => throw new CustomerValidationException(result.Errors);

Requirements

One of the following SDKs: .NET 8 / 9 / 10 (.NET 10 recommended).

Depends on JorgeCostaMacia.GuidFactory and FluentValidation.

About

JorgeCostaMacia.Exception is part of shared-net — a set of foundational, self-contained .NET packages, each scoped to a single concern and reusable across your bounded contexts.

Author: Jorge Costa Maciá

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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 (4)

Showing the top 4 NuGet packages that depend on JorgeCostaMacia.Exception:

Package Downloads
JorgeCostaMacia.ValueObject

Immutable, type-safe value objects with a three-verb creation surface (constructor hydrates, From converts, Create fabricates validated), plus their FluentValidation validators and typed validation exceptions

JorgeCostaMacia.Http.Exception.Serilog

Serilog exception handler that logs every unhandled exception (enriched with domain aggregate metadata and the authenticated user) without producing the response

JorgeCostaMacia.Http.Exception

Global HTTP exception-handling middleware that maps domain, validation and bad-request exceptions to the right HTTP status code

JorgeCostaMacia.Http.ProblemDetails

RFC 7807 ProblemDetails responses enriched with request/trace/node ids and domain aggregate metadata, with handlers for domain and bad-request exceptions

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.0.4 108 7/22/2026
6.0.3 107 7/22/2026
6.0.2 199 7/19/2026
6.0.1 196 7/15/2026
6.0.0 188 7/13/2026
5.0.0 134 7/12/2026
4.3.0 130 7/12/2026
4.2.0 192 7/11/2026
4.1.0 135 7/10/2026
4.0.0 204 7/9/2026
3.0.1 138 7/8/2026
2.0.8 181 7/1/2026
2.0.7 233 6/30/2026
2.0.6 118 6/30/2026
2.0.5 119 6/30/2026
2.0.4 130 6/30/2026
2.0.3 104 6/30/2026
2.0.0 105 6/29/2026
1.0.1 97 6/29/2026
1.0.0 163 6/29/2026