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:
25
DocumentOperator.Domain/Common/Exceptions/DomainException.cs
Normal file
25
DocumentOperator.Domain/Common/Exceptions/DomainException.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace DocumentOperator.Domain.Common.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Base exception for all domain-related exceptions.
|
||||
/// Caught by the Exception Handling Middleware in the API layer.
|
||||
/// </summary>
|
||||
public abstract class DomainException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Error code for categorization and logging.
|
||||
/// </summary>
|
||||
public string ErrorCode { get; }
|
||||
|
||||
protected DomainException(string message, string errorCode)
|
||||
: base(message)
|
||||
{
|
||||
ErrorCode = errorCode;
|
||||
}
|
||||
|
||||
protected DomainException(string message, string errorCode, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
ErrorCode = errorCode;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user