Table of Contents

Struct ExceptionHandlerResult

Namespace
Excalibur.Dispatch.Middleware.ErrorHandling
Assembly
Excalibur.Dispatch.dll

Represents the result of a typed exception handler's attempt to handle an exception.

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

Remarks

This is a value type to avoid allocations on the hot path when exceptions are not handled.

Properties

IsHandled

Gets a value indicating whether the exception was handled.

public bool IsHandled { get; }

Property Value

bool

true if the exception was handled; otherwise, false.

Result

Gets the message result to return when the exception is handled.

public IMessageResult? Result { get; }

Property Value

IMessageResult

The message result, or null if not handled.

Methods

Equals(ExceptionHandlerResult)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ExceptionHandlerResult other)

Parameters

other ExceptionHandlerResult

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Handled(IMessageResult)

Creates a result indicating the exception was handled with the specified result.

public static ExceptionHandlerResult Handled(IMessageResult result)

Parameters

result IMessageResult

The message result to return.

Returns

ExceptionHandlerResult

A handled exception result.

NotHandled()

Creates a result indicating the exception was not handled and should propagate.

public static ExceptionHandlerResult NotHandled()

Returns

ExceptionHandlerResult

An unhandled exception result.

Operators

operator ==(ExceptionHandlerResult, ExceptionHandlerResult)

Determines whether two ExceptionHandlerResult instances are equal.

public static bool operator ==(ExceptionHandlerResult left, ExceptionHandlerResult right)

Parameters

left ExceptionHandlerResult

The left operand.

right ExceptionHandlerResult

The right operand.

Returns

bool

true if the instances are equal; otherwise, false.

operator !=(ExceptionHandlerResult, ExceptionHandlerResult)

Determines whether two ExceptionHandlerResult instances are not equal.

public static bool operator !=(ExceptionHandlerResult left, ExceptionHandlerResult right)

Parameters

left ExceptionHandlerResult

The left operand.

right ExceptionHandlerResult

The right operand.

Returns

bool

true if the instances are not equal; otherwise, false.