Class ErrorsOf<T1, T2>
- Namespace
- REslava.Result.AdvancedPatterns
- Assembly
- REslava.Result.dll
A type-safe error union of two possible error types. Inherits shared dispatch from OneOfBase<T1, T2> and implements IError by delegating Message and Tags to the active case.
public sealed class ErrorsOf<T1, T2> : OneOfBase<T1, T2>, IOneOf<T1, T2>, IError, IReason, IEquatable<ErrorsOf<T1, T2>> where T1 : IError where T2 : IError
Type Parameters
- Inheritance
-
OneOfBase<T1, T2>ErrorsOf<T1, T2>
- Implements
-
IOneOf<T1, T2>IEquatable<ErrorsOf<T1, T2>>
- Inherited Members
- Extension Methods
Remarks
Use ErrorsOf<T1, T2> as the TError in Result<TValue, TError>
to accumulate the union of error types across a pipeline built with Bind.
Properties
Message
Gets the human-readable description of this reason.
public string Message { get; init; }
Property Value
Tags
Gets the structured metadata attached to this reason.
Keys are string labels; values are arbitrary objects (e.g. HTTP status codes, field names).
Use WithTag on any concrete reason to attach metadata fluently.
public ImmutableDictionary<string, object> Tags { get; init; }
Property Value
Methods
Equals(ErrorsOf<T1, T2>?)
Determines equality between two ErrorsOf instances.
public bool Equals(ErrorsOf<T1, T2>? other)
Parameters
otherErrorsOf<T1, T2>
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
FromT1(T1)
Creates an ErrorsOf containing a T1 error.
public static ErrorsOf<T1, T2> FromT1(T1 value)
Parameters
valueT1
Returns
- ErrorsOf<T1, T2>
FromT2(T2)
Creates an ErrorsOf containing a T2 error.
public static ErrorsOf<T1, T2> FromT2(T2 value)
Parameters
valueT2
Returns
- ErrorsOf<T1, T2>
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
Operators
operator ==(ErrorsOf<T1, T2>?, ErrorsOf<T1, T2>?)
Equality operator.
public static bool operator ==(ErrorsOf<T1, T2>? left, ErrorsOf<T1, T2>? right)
Parameters
Returns
implicit operator ErrorsOf<T1, T2>(T1)
Implicit conversion from T1 to ErrorsOf<T1, T2>.
public static implicit operator ErrorsOf<T1, T2>(T1 value)
Parameters
valueT1
Returns
- ErrorsOf<T1, T2>
implicit operator ErrorsOf<T1, T2>(T2)
Implicit conversion from T2 to ErrorsOf<T1, T2>.
public static implicit operator ErrorsOf<T1, T2>(T2 value)
Parameters
valueT2
Returns
- ErrorsOf<T1, T2>
operator !=(ErrorsOf<T1, T2>?, ErrorsOf<T1, T2>?)
Inequality operator.
public static bool operator !=(ErrorsOf<T1, T2>? left, ErrorsOf<T1, T2>? right)