You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
839 B

"""
业务异常类
"""
from .base import BusinessError
class ValidationError(BusinessError):
"""数据验证错误"""
def __init__(self, message: str, field: str = None):
self.field = field
super().__init__(message, "VALIDATION_ERROR")
class ResourceNotFoundError(BusinessError):
"""资源未找到错误"""
def __init__(self, message: str, resource_type: str = None):
self.resource_type = resource_type
super().__init__(message, "RESOURCE_NOT_FOUND")
class PermissionError(BusinessError):
"""权限错误"""
def __init__(self, message: str = "权限不足"):
super().__init__(message, "PERMISSION_DENIED")
class ConfigurationError(BusinessError):
"""配置错误"""
def __init__(self, message: str):
super().__init__(message, "CONFIGURATION_ERROR")