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
messagestringA 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
messagestringA message naming the undeclared type and how to declare it.
innerExceptionExceptionThe 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
eventTypeTypeThe CLR type of the event the resolver does not declare.
aggregateIdstringThe identifier of the stream the append targeted.
aggregateTypestringThe aggregate type name the append targeted.
innerExceptionExceptionThe 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
AggregateType
Gets the aggregate type name the refused append targeted.
public string? AggregateType { get; }
Property Value
EventType
Gets the CLR type of the event the configured resolver does not declare.
public Type? EventType { get; }