feat: 鉴权依赖(debug头/归属断言/越权审计) + 风控4 API(台账/处置/校验/AML扫描, B6)

This commit is contained in:
2026-09-06 18:37:53 +08:00
parent d1982804da
commit e3fcf28b27
5 changed files with 616 additions and 6 deletions
+24 -1
View File
@@ -1 +1,24 @@
"""业务异常与鉴权错误码(对齐 JWT-RBAC 手册)。"""
"""业务异常与鉴权错误码(对齐 JWT-RBAC 手册)。
NotFoundError 继承 LookupError:服务层既有 `raise LookupError`(customer/product
not found)自动获得精确类型与 404 语义,调用方 except LookupError 无需改动
(B5 评审 P3-1 的收敛锚点)。
"""
from __future__ import annotations
class NotFoundError(LookupError):
"""资源不存在(HTTP 404)。"""
class PermissionDenied(PermissionError):
"""归属/权限拒绝(HTTP 403);code 对齐 JWT 手册 §6.1 错误码。"""
def __init__(self, code: str, message: str) -> None:
super().__init__(message)
self.code = code
class StateConflict(ValueError):
"""状态机冲突(HTTP 409;如处置非 pending_review 的预警单)。"""