JorgeCostaMacia.DDD.Exception 11.2.4

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package JorgeCostaMacia.DDD.Exception --version 11.2.4
                    
NuGet\Install-Package JorgeCostaMacia.DDD.Exception -Version 11.2.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.DDD.Exception" Version="11.2.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JorgeCostaMacia.DDD.Exception" Version="11.2.4" />
                    
Directory.Packages.props
<PackageReference Include="JorgeCostaMacia.DDD.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.DDD.Exception --version 11.2.4
                    
#r "nuget: JorgeCostaMacia.DDD.Exception, 11.2.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.DDD.Exception@11.2.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.DDD.Exception&version=11.2.4
                    
Install as a Cake Addin
#tool nuget:?package=JorgeCostaMacia.DDD.Exception&version=11.2.4
                    
Install as a Cake Tool

JorgeCostaMacia.DDD.Exception

A small hierarchy of domain exceptions: validation, not found, already exists and business errors. Each one carries an occurrence id, its type, a fixed code, an HTTP status and the time, to trace it across logs and API responses.

NuGet Downloads Build License


Install

dotnet add package JorgeCostaMacia.DDD.Exception

Usage

using JorgeCostaMacia.DDD.Exception.Domain;

throw new OrderNotFoundException(orderId);
// Message: "<occurrence id>/OrderNotFoundException => Order <id> was not found."
// AggregateCode: the fixed code of OrderNotFoundException; AggregateHttpCode: 404

The types are abstract: a bounded context derives one concrete exception for each error it can raise, with a fixed UUIDv7 code of its own.

Type For Default HTTP status
DomainException the root of the hierarchy 500
ValidationException validation failures (Validations) 400
NotFoundException a thing that does not exist 404
ExistException a thing that already exists 409
ErrorException business errors (Errors) 400

Documentation

  • Exceptions: the metadata, the fixed code, and the two constructors of a concrete exception.
  • samples/Shop: an application with an Orders module that uses every package together.

Requirements

The .NET 10 or .NET 11 SDK.

Depends on FluentValidation.

About

JorgeCostaMacia.DDD.Exception is part of ddd-dotnet: DDD building blocks for .NET, with value objects and their FluentValidation validators, aggregates, entities, domain events and the domain exception hierarchy, each package scoped to a single concern.

Author: Jorge Costa Maciá

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.  net11.0 is compatible. 
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.DDD.Exception:

Package Downloads
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

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.DDD.ValueObject

Immutable, type-safe value objects with a hydrating constructor and four factories (From and FromOrNull convert, Create and CreateOrNull validate), plus their FluentValidation validators and typed validation exceptions

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.2.5-dev.12 45 12/3/2026
11.2.5-dev.11 47 12/3/2026
11.2.5-dev.10 44 12/3/2026
11.2.5-dev.9 43 12/3/2026
11.2.4 55 12/2/2026
11.2.3 52 12/2/2026
11.2.2 54 12/2/2026
11.2.1 59 12/2/2026
11.2.0 54 12/2/2026
11.1.0 140 12/2/2026
11.0.2 713 11/9/2026
11.0.1 119 11/9/2026
11.0.0 308 11/8/2026