c74f1a82d9
CI/CD Pipeline / Check if frontend-only change (push) Has been cancelled
CI/CD Pipeline / Validate - Code Quality (push) Has been cancelled
CI/CD Pipeline / Validate - Type Check (mypy) (push) Has been cancelled
CI/CD Pipeline / Validate - Migration (alembic) (push) Has been cancelled
CI/CD Pipeline / Unit Tests (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (push) Has been cancelled
CI/CD Pipeline / PR Build API Image (push) Has been cancelled
CI/CD Pipeline / PR Build Web Image (push) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (push) Has been cancelled
CI/CD Pipeline / Build Staging API Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Worker Image (push) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (push) Has been cancelled
CI/CD Pipeline / Build Production API Image (push) Has been cancelled
CI/CD Pipeline / Build Production Web Image (push) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (push) Has been cancelled
CI/CD Pipeline / Deploy Production (push) Has been cancelled
CI/CD Pipeline / Production Browser E2E (push) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (push) Has been cancelled
36 lines
742 B
Python
36 lines
742 B
Python
"""
|
|
领域层通用异常定义。
|
|
|
|
所有应用层共享的通用异常在此统一定义,
|
|
消除各 use_cases 模块中重复的异常类。
|
|
领域特定的异常仍在各模块内定义。
|
|
"""
|
|
|
|
|
|
class DomainError(Exception):
|
|
"""领域层异常基类。"""
|
|
|
|
pass
|
|
|
|
|
|
class NotFoundError(DomainError):
|
|
"""资源不存在。"""
|
|
|
|
pass
|
|
|
|
|
|
class ValidationError(DomainError):
|
|
"""业务规则校验失败。"""
|
|
|
|
pass
|
|
|
|
|
|
class QuotaExceededError(DomainError):
|
|
"""配额超限。"""
|
|
|
|
def __init__(self, dimension: str, limit: float, used: float) -> None:
|
|
self.dimension = dimension
|
|
self.limit = limit
|
|
self.used = used
|
|
super().__init__(f"Quota exceeded for {dimension}: {used}/{limit}")
|