Class ConversionError

Namespace
REslava.Result
Assembly
REslava.Result.dll

Represents an error that occurred during implicit type conversion. This error is used when implicit operators receive invalid input (null, empty collections, etc.) instead of throwing exceptions, keeping the API consistent with the Result pattern philosophy.

public class ConversionError : Reason<ConversionError>, IError, IReason
Inheritance
ConversionError
Implements
Inherited Members
Extension Methods

Remarks

ConversionError is automatically created in these scenarios:

  • Null error provided to implicit conversion
  • Empty error array provided to implicit conversion
  • Empty error list provided to implicit conversion

Constructors

ConversionError(string)

Creates a new ConversionError with the specified reason. Automatically tags the error as a conversion error with Warning severity.

public ConversionError(string reason)

Parameters

reason string

Methods

CreateNew(string, ImmutableDictionary<string, object>)

Creates a new ConversionError with updated message and tags (CRTP pattern).

protected override ConversionError CreateNew(string message, ImmutableDictionary<string, object> tags)

Parameters

message string
tags ImmutableDictionary<string, object>

Returns

ConversionError

WithConversionType(string)

Adds conversion-specific context to the error. Returns ConversionError for fluent chaining.

public ConversionError WithConversionType(string conversionType)

Parameters

conversionType string

Returns

ConversionError

WithProvidedValue(object?)

Adds the provided value to error context. Returns ConversionError for fluent chaining.

public ConversionError WithProvidedValue(object? value)

Parameters

value object

Returns

ConversionError