Table of Contents

Class FlattenValidationErrorsExtensions

Namespace
Trellis
Assembly
Trellis.Results.dll

Extension methods for extracting ValidationError data from failed results.

public static class FlattenValidationErrorsExtensions
Inheritance
FlattenValidationErrorsExtensions
Inherited Members

Methods

FlattenValidationErrors<T>(Result<T>)

Extracts and merges all ValidationError field errors from the result's error. If the error is an AggregateError, all nested validation errors are flattened and merged. If the error is a ValidationError, it is returned directly.

public static ValidationError? FlattenValidationErrors<T>(this Result<T> result)

Parameters

result Result<T>

The result to extract validation errors from.

Returns

ValidationError

A merged ValidationError containing all field errors, or null if no validation errors exist.

Type Parameters

T

Type of the result value.

Remarks