DcsvIo.D2.ErrorCodes.Category 0.1.1

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

DcsvIo.D2.ErrorCodes.Category

Foundational zero-dependency (BCL-only) leaf that exposes the closed ErrorCategory classification — the nine-value semantic/telemetry class every D2Result and every error code carries. Source-generated from the error-category contract spec. Lives here so result-core and the error-codes registry can reference ErrorCategory downward without pulling the merged-catalog generator.

The category is the producer's coarse signal — infrastructure_unavailable, not_found, validation_failure — so a consumer can do generic class-based handling (retry any InfrastructureUnavailable, surface any NotFound as a 404) without importing the producer's error-code catalog.

Install

dotnet add package DcsvIo.D2.ErrorCodes.Category

Public API

Export Purpose
ErrorCategory Closed enum — one member per category (e.g. ErrorCategory.NotFound). Carries [JsonConverter(typeof(ErrorCategoryJsonConverter))] so it serializes as its wire string.
ErrorCategoryWire.ToWire this ErrorCategory → string — the canonical snake_case wire string (e.g. ErrorCategory.ValidationFailure → "validation_failure"). Throws on an undefined member.
ErrorCategoryWire.TryFromWire string → bool + out ErrorCategory — parses a wire string back to the enum. Returns false for any unknown string (never throws).
ErrorCategoryJsonConverter JsonConverter<ErrorCategory> — reads/writes the snake_case wire string; unknown wire strings throw JsonException (strict policy).
ErrorCategory.NotFound.ToWire();                       // "not_found"
ErrorCategoryWire.TryFromWire("conflict", out var c);  // true, c == ErrorCategory.Conflict
JsonSerializer.Serialize(ErrorCategory.RateLimited);   // "rate_limited"

Dependency edge

DcsvIo.D2.ErrorCodes.Category   (BCL-only — no project references)
                ▲
                ├── DcsvIo.D2.ErrorCodes.Registry   (references ErrorCategory downward)
                └── DcsvIo.D2.Result                (D2Result.Category is a typed ErrorCategory?)

ErrorCategory.g.cs is emitted by the sibling DcsvIo.D2.ErrorCodes.Category.SourceGen analyzer (referenced build-only, no runtime dll). The registry references this leaf instead of emitting the enum itself, and result-core references it so D2Result.Category is a typed ErrorCategory? — both arrows point downward into this zero-dep sink, so the references stay acyclic.

The TypeScript package @dcsv-io/d2-error-category is the zero-dep leaf whose ErrorCategory string-union is generated from the same error-category spec. A cross-runtime parity fixture asserts the .NET wire set ≡ the TS union ≡ the spec.

Source of truth

The error-category contract spec declares the nine category wire strings. The closed set matches the category enum in the error-codes canonical schema byte-for-byte; the error-codes registry cross-checks every code's category against this set at build time.

Never hand-edit generated ErrorCategory.g.cs — change the spec and rebuild.

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.
  • net10.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on DcsvIo.D2.ErrorCodes.Category:

Package Downloads
DcsvIo.D2.Result

D2Result — the errors-as-values pattern for D2, replacing exception-based control flow with TKMessage-typed user-facing messages.

DcsvIo.D2.Result.Grpc

Faithful in-memory to wire to in-memory D2Result round-trip for D2 over the gRPC D2ResultProto response envelope.

DcsvIo.D2.ErrorCodes.Registry

Merged cross-catalog error-code registry for D2 — a frozen code-to-metadata lookup aggregating every error-code spec.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 474 7/17/2026
0.1.0 489 7/17/2026