Class ValidationError
Represents a validation error encountered during mutation or state validation. Contains information about the invalid field, the error message, and optional metadata.
Inherited Members
Namespace: ModularityKit.Mutator.Abstractions.Results
Assembly: ModularityKit.Mutator.dll
Syntax
public sealed class ValidationError
Constructors
| Edit this page View SourceValidationError(string, string, string?)
Constructs a new ValidationError instance with an error code.
Declaration
public ValidationError(string path, string message, string? code = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | Path to the invalid property or field. |
| string | message | Description of the validation error. |
| string | code | Error code for categorization or localization. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
Properties
| Edit this page View SourceAttemptedValue
The value that triggered the validation error, if applicable. Useful for diagnostics and debugging.
Declaration
public object? AttemptedValue { get; init; }
Property Value
| Type | Description |
|---|---|
| object |
Code
Optional error code, useful for categorization or localization (i18n).
Declaration
public string? Code { get; }
Property Value
| Type | Description |
|---|---|
| string |
Message
Human-readable description of the error. Should clearly explain why the value is invalid.
Declaration
public string Message { get; }
Property Value
| Type | Description |
|---|---|
| string |
Path
Path to the property or field that caused the validation error. Examples: "Email", "Address.City", "Wallet.Owners[0].Role".
Declaration
public string Path { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceToString()
Returns a string representation of the validation error, including severity, path, and message.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |