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
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
otherExceptionHandlerResultAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
resultIMessageResultThe 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
leftExceptionHandlerResultThe left operand.
rightExceptionHandlerResultThe right operand.
Returns
operator !=(ExceptionHandlerResult, ExceptionHandlerResult)
Determines whether two ExceptionHandlerResult instances are not equal.
public static bool operator !=(ExceptionHandlerResult left, ExceptionHandlerResult right)
Parameters
leftExceptionHandlerResultThe left operand.
rightExceptionHandlerResultThe right operand.