Table of Contents

Class DuplicateErasureRequestException

Namespace
Excalibur.Compliance
Assembly
Excalibur.Compliance.Abstractions.dll

Thrown by SaveRequestAsync(ErasureRequest, DateTimeOffset, CancellationToken) when — and only when — a request with the same RequestId is already stored.

public sealed class DuplicateErasureRequestException : InvalidOperationException, ISerializable
Inheritance
DuplicateErasureRequestException
Implements
Inherited Members

Remarks

This type exists so that "the request is already on file" is distinguishable by the caller from every other reason a save can fail. It is the difference between a caller correctly treating the write as already done and a caller wrongly abandoning a write that never happened: an erasure request is a data subject's exercise of a statutory right, and one dropped on a misread failure is not recoverable by anything the caller does later.

It derives from InvalidOperationException because a duplicate insert genuinely is an invalid operation on the store's current state, and because that keeps an existing broad catch (InvalidOperationException) working. A caller that needs the duplicate signal specifically must catch this type: the base type is also raised for unrelated conditions — a store whose schema is absent, a disposed store, an unresolved ambient tenant — and treating any of those as "already on file" silently loses the request.

Implementations raise this rather than the underlying database provider's own duplicate-key exception, so a caller can handle the condition without referencing that provider or knowing its error codes. The provider's exception is preserved as InnerException so the underlying cause stays diagnosable.

Constructors

DuplicateErasureRequestException()

Initializes a new instance of the DuplicateErasureRequestException class.

public DuplicateErasureRequestException()

DuplicateErasureRequestException(string)

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

public DuplicateErasureRequestException(string message)

Parameters

message string

The error message.

DuplicateErasureRequestException(string, Exception?)

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

public DuplicateErasureRequestException(string message, Exception? innerException)

Parameters

message string

The error message.

innerException Exception

The underlying store failure that reported the duplicate, when there was one.

Properties

RequestId

Gets the identifier of the request that is already stored.

public Guid? RequestId { get; init; }

Property Value

Guid?

The RequestId that was re-filed, or null when the exception was constructed without one.

Methods

ForRequestId(Guid, Exception?)

Creates an exception for a request identifier that is already stored.

public static DuplicateErasureRequestException ForRequestId(Guid requestId, Exception? innerException = null)

Parameters

requestId Guid

The request identifier that was re-filed.

innerException Exception

The underlying store failure that reported the duplicate, if any.

Returns

DuplicateErasureRequestException

The exception to throw.