Class ReadModelDoesNotExistForCommand

Namespace
Cratis.Arc.Queries
Assembly
Cratis.Arc.Core.dll

Exception that gets thrown when a command requires a non-nullable read model that does not exist for the command's resolved key.

public class ReadModelDoesNotExistForCommand : Exception, ISerializable, IValidationFailure
Inheritance
ReadModelDoesNotExistForCommand
Implements
Inherited Members
Extension Methods

Remarks

The command carried a usable key, but no read model exists for it. A nullable read model dependency tolerates this by receiving null; a non-nullable ("must exist") dependency cannot, and this would otherwise surface as a server error (HTTP 500) leaking the read model type. It implements IValidationFailure, so the pipeline surfaces it as a validation failure (HTTP 400) with a message that does not reveal the read model type.

Constructors

ReadModelDoesNotExistForCommand(Type)

Exception that gets thrown when a command requires a non-nullable read model that does not exist for the command's resolved key.

public ReadModelDoesNotExistForCommand(Type readModelType)

Parameters

readModelType Type

The type of read model that does not exist.

Remarks

The command carried a usable key, but no read model exists for it. A nullable read model dependency tolerates this by receiving null; a non-nullable ("must exist") dependency cannot, and this would otherwise surface as a server error (HTTP 500) leaking the read model type. It implements IValidationFailure, so the pipeline surfaces it as a validation failure (HTTP 400) with a message that does not reveal the read model type.

Properties

ReadModelType

Gets the type of read model that does not exist.

public Type ReadModelType { get; }

Property Value

Type

ValidationResult

Gets the ValidationResult describing why the command is invalid.

public ValidationResult ValidationResult { get; }

Property Value

ValidationResult

Remarks

Carries DependencyUnavailable because no rule rejected anything - the command was never evaluated against its rules at all. Without that, this is indistinguishable from a domain rejection, and a spec asserting only that the command was rejected passes with every rule neutered.