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
692 B
C#
25 lines
692 B
C#
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;
|
|
}
|
|
} |