Files
DocumentService/DocumentOperator.Domain/Common/Exceptions/DomainValidationException.cs
TekH a729df6fda refactor: Make Domain exceptions serializable and add XML docs
- Add [Serializable] attribute to all custom exceptions
- Add protected constructors for serialization support
- Add XML documentation comments
- Update SwissQrCodeNotFoundException message format
2026-07-16 15:47:44 +02:00

29 lines
946 B
C#

namespace DocumentOperator.Domain.Common.Exceptions;
/// <summary>
/// Exception thrown when domain validation fails (e.g., invalid Value Objects).
/// Maps to HTTP 400 Bad Request in the API layer.
/// </summary>
[Obsolete("This exception is deprecated. Use more specific exceptions for domain validation errors.")]
public class DomainValidationException : DomainException
{
public string PropertyName { get; }
public DomainValidationException(string message)
: base(message, "DOMAIN_VALIDATION_ERROR")
{
PropertyName = string.Empty;
}
public DomainValidationException(string propertyName, string message)
: base(message, "DOMAIN_VALIDATION_ERROR")
{
PropertyName = propertyName;
}
public DomainValidationException(string message, Exception innerException)
: base(message, "DOMAIN_VALIDATION_ERROR", innerException)
{
PropertyName = string.Empty;
}
}