Class DispatchSerializationException
- Namespace
- Excalibur.Dispatch.Exceptions
- Assembly
- Excalibur.Dispatch.dll
Dispatch-specific serialization exception that extends DispatchException.
public sealed class DispatchSerializationException : DispatchException, ISerializable
- Inheritance
-
DispatchSerializationException
- Implements
- Inherited Members
- Extension Methods
Remarks
This exception provides Dispatch-specific error handling features on top of the base SerializationException. It adds:
- Error code categorization
- Distributed tracing support (TraceId, SpanId, CorrelationId)
- Fluent configuration API (WithContext, WithCorrelationId, etc.)
- Extended problem details support
For code in the Dispatch package or consumers who need DispatchException features, use this class. For code in Excalibur.Dispatch or serializer packages that only need basic serialization exception functionality, use SerializationException.
Constructors
DispatchSerializationException()
Initializes a new instance of the DispatchSerializationException class.
public DispatchSerializationException()
DispatchSerializationException(string)
Initializes a new instance of the DispatchSerializationException class with a specified error message.
public DispatchSerializationException(string message)
Parameters
messagestringThe error message that explains the reason for the exception.
DispatchSerializationException(string, Exception?)
Initializes a new instance of the DispatchSerializationException class with a specified error message and a reference to the inner exception.
public DispatchSerializationException(string message, Exception? innerException)
Parameters
messagestringThe message that describes the error.
innerExceptionExceptionThe exception that is the cause of the current exception.
DispatchSerializationException(string, string)
Initializes a new instance of the DispatchSerializationException class with a specified error code and message.
public DispatchSerializationException(string errorCode, string message)
Parameters
errorCodestringThe error code associated with this exception.
messagestringThe error message that explains the reason for the exception.
DispatchSerializationException(string, string, Exception?)
Initializes a new instance of the DispatchSerializationException class with a specified error code, message, and inner exception.
public DispatchSerializationException(string errorCode, string message, Exception? innerException)
Parameters
errorCodestringThe error code associated with this exception.
messagestringThe error message that explains the reason for the exception.
innerExceptionExceptionThe exception that is the cause of the current exception.
Properties
Operation
Gets or sets the operation being performed when the exception occurred.
public SerializationOperation Operation { get; init; }
Property Value
SerializerId
Gets or sets the serializer ID associated with this exception, if applicable.
public byte? SerializerId { get; init; }
Property Value
- byte?
Remarks
This property is set when the exception is related to a specific serializer, such as when an unknown serializer ID is encountered in a payload.
SerializerName
Gets or sets the name of the serializer that threw the exception.
public string? SerializerName { get; init; }
Property Value
Remarks
When provided, the value must not be empty or whitespace-only. Use null to indicate an unknown serializer.
Exceptions
- ArgumentException
Thrown when set to an empty or whitespace-only string.
TargetType
Gets or sets the type that was being serialized or deserialized when the exception occurred.
public Type? TargetType { get; init; }