Table of Contents

Class EventTypeNotDeclaredException

Namespace
Excalibur.EventSourcing
Assembly
Excalibur.EventSourcing.Abstractions.dll

The exception thrown when an event's type is not declared by the type-info resolver the host configured, so the store cannot serialize it.

public sealed class EventTypeNotDeclaredException : NotSupportedException, ISerializable
Inheritance
EventTypeNotDeclaredException
Implements
Inherited Members

Remarks

A host that supplies a source-generated type-info resolver is stating the closed set of event types its process will ever write. An event outside that set cannot be serialized, and no retry, reload or reconfiguration at run time changes that — only adding the type to the resolver does. It is therefore a defect in the calling program, not an outcome of the append, and is surfaced as a thrown exception rather than a returned AppendResult failure. The same rule places EventBatchTooLargeException and a blank aggregate identifier on the throwing side.

The distinction is load-bearing. A returned failure is indistinguishable from a transient store fault, so a caller retries it; here every retry fails identically and the events are never persisted. Failing loudly on the first append surfaces the missing declaration at once, which is when it can still be fixed.

It derives from NotSupportedException, which is what the underlying serializer raises for an undeclared type and what the exception carries as its InnerException. A caller already handling that broader type keeps working; a caller wanting the offending type reads EventType rather than parsing a message.

Constructors

EventTypeNotDeclaredException()

Initializes a new instance of the EventTypeNotDeclaredException class.

public EventTypeNotDeclaredException()

EventTypeNotDeclaredException(string)

Initializes a new instance of the EventTypeNotDeclaredException class with a message.

public EventTypeNotDeclaredException(string message)

Parameters

message string

A message naming the undeclared type and how to declare it.

EventTypeNotDeclaredException(string, Exception?)

Initializes a new instance of the EventTypeNotDeclaredException class with a message and an inner exception.

public EventTypeNotDeclaredException(string message, Exception? innerException)

Parameters

message string

A message naming the undeclared type and how to declare it.

innerException Exception

The exception that is the cause of the current exception.

EventTypeNotDeclaredException(Type?, string?, string?, Exception?)

Initializes a new instance of the EventTypeNotDeclaredException class describing the event the configured resolver does not declare.

public EventTypeNotDeclaredException(Type? eventType, string? aggregateId, string? aggregateType, Exception? innerException)

Parameters

eventType Type

The CLR type of the event the resolver does not declare.

aggregateId string

The identifier of the stream the append targeted.

aggregateType string

The aggregate type name the append targeted.

innerException Exception

The serializer exception that reported the missing metadata.

Properties

AggregateId

Gets the identifier of the stream the refused append targeted.

public string? AggregateId { get; }

Property Value

string

The aggregate identifier, or null when not specified.

AggregateType

Gets the aggregate type name the refused append targeted.

public string? AggregateType { get; }

Property Value

string

The aggregate type name, or null when not specified.

EventType

Gets the CLR type of the event the configured resolver does not declare.

public Type? EventType { get; }

Property Value

Type

The undeclared event type, or null when not specified.