Interface ICommandExceptionMapper

Namespace
Cratis.Arc.Commands
Assembly
Cratis.Arc.Core.dll

Defines convention-discovered mappings of exceptions escaping command execution or response processing to command failures.

public interface ICommandExceptionMapper
Extension Methods

Remarks

Implementations are discovered through IInstancesOf<T> and resolved from the command's service scope. The pipeline uses the first mapper that accepts an exception, before completing execution scopes. If none accepts it, the existing FromException(CorrelationId, Exception) behavior applies.

Methods

TryMap(CommandContext, Exception, out CommandResult?)

Tries to map an exception to a command failure without parsing exception messages.

bool TryMap(CommandContext context, Exception exception, out CommandResult? result)

Parameters

context CommandContext

The invocation whose execution or response processing failed.

exception Exception

The exception escaping that invocation.

result CommandResult

The mapped failure, preserving the invocation's correlation identifier, or null when declined.

Returns

bool

True when the exception was mapped; false to leave it for another mapper or the default conversion.