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.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user