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.
28 lines
843 B
C#
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;
|
|
}
|
|
} |