Table of Contents

Struct MediatorError

Namespace
SimpleMediator
Assembly
SimpleMediator.dll

Minimal immutable mediator error representation with optional exception metadata.

public readonly record struct MediatorError : IEquatable<MediatorError>
Implements
Inherited Members
Extension Methods

Properties

Exception

Optional exception information associated with the failure that callers may inspect.

public Option<Exception> Exception { get; }

Property Value

Option<Exception>

Message

Human-readable description of the failure.

public string Message { get; }

Property Value

string

Methods

New(Exception)

Creates an error from an exception, preserving the exception message by default.

public static MediatorError New(Exception exception)

Parameters

exception Exception

Returns

MediatorError

New(Exception, string)

Creates an error from an exception and explicit message override.

public static MediatorError New(Exception exception, string message)

Parameters

exception Exception
message string

Returns

MediatorError

New(string)

Creates an error from a message.

public static MediatorError New(string message)

Parameters

message string

Returns

MediatorError

New(string, Exception?)

Creates an error from a message and optional exception.

public static MediatorError New(string message, Exception? exception)

Parameters

message string
exception Exception

Returns

MediatorError

Operators

implicit operator MediatorError(Exception)

Implicit conversion from Exception to MediatorError.

public static implicit operator MediatorError(Exception exception)

Parameters

exception Exception

Returns

MediatorError

implicit operator MediatorError(string)

Implicit conversion from string to MediatorError.

public static implicit operator MediatorError(string message)

Parameters

message string

Returns

MediatorError