Table of Contents

Class DomainError

Namespace
JD.Domain.Abstractions
Assembly
JD.Domain.Abstractions.dll

Represents a domain error with detailed information about a rule violation or validation failure.

public sealed class DomainError
Inheritance
DomainError
Inherited Members

Properties

Code

Gets the error code identifying the type of error.

public required string Code { get; init; }

Property Value

string

Message

Gets the human-readable error message.

public required string Message { get; init; }

Property Value

string

Metadata

Gets additional metadata associated with this error.

public IReadOnlyDictionary<string, object?> Metadata { get; init; }

Property Value

IReadOnlyDictionary<string, object>

Severity

Gets the severity level of the error.

public RuleSeverity Severity { get; init; }

Property Value

RuleSeverity

Tags

Gets the collection of tags associated with this error for categorization.

public IReadOnlyList<string> Tags { get; init; }

Property Value

IReadOnlyList<string>

Target

Gets the target property or path where the error occurred, if applicable.

public string? Target { get; init; }

Property Value

string

Methods

Create(string, string)

Creates a new domain error with the specified code and message.

public static DomainError Create(string code, string message)

Parameters

code string

The error code.

message string

The error message.

Returns

DomainError

A new domain error instance.

Create(string, string, string)

Creates a new domain error with the specified code, message, and target.

public static DomainError Create(string code, string message, string target)

Parameters

code string

The error code.

message string

The error message.

target string

The target property or path.

Returns

DomainError

A new domain error instance.