Ferrous API Reference

All Types / Ferrous.Results

class ContextError

public sealed class ContextError

A chained, anyhow-style error carrying a human-readable context message and an optional inner cause chain for structured error propagation across layers.

Constructors

public ContextError(string message, ContextError? cause = null, object? sourceError = null)

Initializes a new ContextError with a message and optional inner cause.

Parameters
message
The contextual error message.
cause
The optional underlying ContextError cause.
sourceError
The optional original typed error value.

Properties

public string Message

Gets the context message at this layer.

public ContextError? Cause

Gets the underlying cause error, if any.

public object? SourceError

Gets the original typed error value at the root of this error, if any.

Methods

public IEnumerable<string> Chain()

Enumerates all messages in the error chain from outermost context to root cause.

public string FormatChain()

Formats the full error chain as a single readable string (e.g., outer: inner: root).

public override string ToString()