JorgeCostaMacia.DDD.Exception
11.2.4
Prefix Reserved
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
<PackageReference Include="JorgeCostaMacia.DDD.Exception" Version="11.2.4" />
<PackageVersion Include="JorgeCostaMacia.DDD.Exception" Version="11.2.4" />
<PackageReference Include="JorgeCostaMacia.DDD.Exception" />
paket add JorgeCostaMacia.DDD.Exception --version 11.2.4
#r "nuget: JorgeCostaMacia.DDD.Exception, 11.2.4"
#:package JorgeCostaMacia.DDD.Exception@11.2.4
#addin nuget:?package=JorgeCostaMacia.DDD.Exception&version=11.2.4
#tool nuget:?package=JorgeCostaMacia.DDD.Exception&version=11.2.4
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.
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
Ordersmodule 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.
- Repository: github.com/JorgeCostaMacia/ddd-dotnet
- Issues & requests: open an issue
- Contributing: CONTRIBUTING.md
- Security: report a vulnerability
Author: Jorge Costa Maciá
| Product | Versions 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. |
-
net10.0
- FluentValidation (>= 12.2.0)
-
net11.0
- FluentValidation (>= 12.2.0)
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 |