Files
Services.DDDocumentOperator/DocumentOperator.Domain/Common/Exceptions/DomainValidationException.cs
OlgunR d7c416256c Add domain exceptions and update project structure
Implemented a structured exception-handling mechanism in the
domain layer with the addition of `DomainException`,
`DomainValidationException`, `NotFoundException`, and
`PdfProcessingException` classes. These exceptions provide
specific error handling for domain logic and integrate with
centralized middleware.

Updated `ROADMAP.md` to mark Step 2.1 (Domain Exceptions) as
completed and Step 2.2 (Value Objects) as the next task.
Added timeline entries to reflect progress.

Cleaned up `DocumentOperator.Domain.csproj` by removing
unused folder inclusions, indicating a project structure
reorganization.
2026-06-16 16:38:19 +02:00

28 lines
843 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>
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;
}
}