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.
25 lines
798 B
C#
25 lines
798 B
C#
namespace DocumentOperator.Domain.Common.Exceptions;
|
|
|
|
/// <summary>
|
|
/// Exception thrown when a requested resource is not found.
|
|
/// Maps to HTTP 404 Not Found in the API layer.
|
|
/// </summary>
|
|
public class NotFoundException : DomainException
|
|
{
|
|
public string ResourceType { get; }
|
|
public object ResourceId { get; }
|
|
|
|
public NotFoundException(string resourceType, object resourceId)
|
|
: base($"{resourceType} with ID '{resourceId}' was not found.", "RESOURCE_NOT_FOUND")
|
|
{
|
|
ResourceType = resourceType;
|
|
ResourceId = resourceId;
|
|
}
|
|
|
|
public NotFoundException(string resourceType, object resourceId, string customMessage)
|
|
: base(customMessage, "RESOURCE_NOT_FOUND")
|
|
{
|
|
ResourceType = resourceType;
|
|
ResourceId = resourceId;
|
|
}
|
|
} |