using System; namespace GermanApp.Domain.Exceptions; /// /// Base exception for domain layer errors. /// All domain-specific exceptions should inherit from this. /// public class DomainException : Exception { public DomainException(string message) : base(message) { } public DomainException(string message, Exception innerException) : base(message, innerException) { } } /// /// Exception thrown when a business rule validation fails. /// public class ValidationException : DomainException { public ValidationException(string message) : base(message) { } public ValidationException(string message, Exception innerException) : base(message, innerException) { } } /// /// Exception thrown when an entity is not found. /// public class NotFoundException : DomainException { public NotFoundException(string entityName, int id) : base($"{entityName} with id {id} not found") { } public NotFoundException(string message) : base(message) { } } /// /// Exception thrown when attempting to perform an invalid operation. /// public class InvalidOperationException : DomainException { public InvalidOperationException(string message) : base(message) { } }