Class DuplicateErasureCertificateException
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Thrown by SaveCertificateAsync(ErasureCertificate, CancellationToken) when — and only when — a certificate with the same CertificateId is already stored.
public sealed class DuplicateErasureCertificateException : InvalidOperationException, ISerializable
- Inheritance
-
DuplicateErasureCertificateException
- Implements
- Inherited Members
Remarks
A certificate is the erasure attestation itself, so this operation inserts and never overwrites: replacing one in place would rewrite evidence that has already been issued and may already have been shown to a data subject or an auditor.
It derives from InvalidOperationException so an existing broad
catch (InvalidOperationException) keeps working, but 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 issued" would report an attestation that was never persisted.
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. The provider's exception is preserved as InnerException.
Constructors
DuplicateErasureCertificateException()
Initializes a new instance of the DuplicateErasureCertificateException class.
public DuplicateErasureCertificateException()
DuplicateErasureCertificateException(string)
Initializes a new instance of the DuplicateErasureCertificateException class with a message.
public DuplicateErasureCertificateException(string message)
Parameters
messagestringThe error message.
DuplicateErasureCertificateException(string, Exception?)
Initializes a new instance of the DuplicateErasureCertificateException class with a message and inner exception.
public DuplicateErasureCertificateException(string message, Exception? innerException)
Parameters
messagestringThe error message.
innerExceptionExceptionThe underlying store failure that reported the duplicate, when there was one.
Properties
CertificateId
Gets the identifier of the certificate that is already stored.
public Guid? CertificateId { get; init; }
Property Value
- Guid?
The CertificateId that was re-issued, or null when the exception was constructed without one.
Methods
ForCertificateId(Guid, Exception?)
Creates an exception for a certificate identifier that is already stored.
public static DuplicateErasureCertificateException ForCertificateId(Guid certificateId, Exception? innerException = null)
Parameters
certificateIdGuidThe certificate identifier that was re-issued.
innerExceptionExceptionThe underlying store failure that reported the duplicate, if any.
Returns
- DuplicateErasureCertificateException
The exception to throw.