Skip to content

Class ExceptionHandlingPolicy ​

Namespace: Momentum.ServiceDefaults.Messaging.Middlewares
Assembly: Momentum.ServiceDefaults.dll

Wolverine policy that ensures exception handling middleware is applied to all message handlers.

csharp
[ExcludeFromCodeCoverage]
public class ExceptionHandlingPolicy : IHandlerPolicy, IWolverinePolicy

Inheritance ​

object ← ExceptionHandlingPolicy

Implements ​

IHandlerPolicy, IWolverinePolicy

Inherited Members ​

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Remarks ​

This policy automatically adds the ExceptionHandlingFrame to all handler chains that don't already have it, ensuring consistent exception handling across the messaging system. The policy is registered during Wolverine configuration and applies to all discovered handlers.

Constructors ​

ExceptionHandlingPolicy() ​

csharp
public ExceptionHandlingPolicy()

Methods ​

Apply(IReadOnlyList<HandlerChain>, GenerationRules, IServiceContainer) ​

Applies the exception handling policy to handler chains.

csharp
public void Apply(IReadOnlyList<HandlerChain> chains, GenerationRules rules, IServiceContainer container)

Parameters ​

chains IReadOnlyList<HandlerChain>

The collection of handler chains to process.

rules GenerationRules

The code generation rules.

container IServiceContainer

The service container.

Remarks ​

This method iterates through all handler chains and adds an ExceptionHandlingFrame to those that don't already have one, ensuring comprehensive exception handling.