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,34 @@
|
||||
namespace DocumentOperator.Domain.Common.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when PDF processing operations fail.
|
||||
/// Maps to HTTP 500 Internal Server Error or 422 Unprocessable Entity in the API layer.
|
||||
/// </summary>
|
||||
public class PdfProcessingException : DomainException
|
||||
{
|
||||
public string Operation { get; }
|
||||
|
||||
public PdfProcessingException(string operation, string message)
|
||||
: base($"PDF processing failed during '{operation}': {message}", "PDF_PROCESSING_ERROR")
|
||||
{
|
||||
Operation = operation;
|
||||
}
|
||||
|
||||
public PdfProcessingException(string operation, string message, Exception innerException)
|
||||
: base($"PDF processing failed during '{operation}': {message}", "PDF_PROCESSING_ERROR", innerException)
|
||||
{
|
||||
Operation = operation;
|
||||
}
|
||||
|
||||
public PdfProcessingException(string message)
|
||||
: base(message, "PDF_PROCESSING_ERROR")
|
||||
{
|
||||
Operation = "Unknown";
|
||||
}
|
||||
|
||||
public PdfProcessingException(string message, Exception innerException)
|
||||
: base(message, "PDF_PROCESSING_ERROR", innerException)
|
||||
{
|
||||
Operation = "Unknown";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user