dellweb3's picture
Publish expandable work summaries and six-module runtime log dock
fe948cf verified
Raw History Blame Contribute Delete
628 Bytes
"""Small errors mapped at the API boundary, without leaking private fixture data."""
class GatewayError(Exception):
def __init__(self, status: int, code: str, message: str, details: dict | None = None):
self.status = status
self.code = code
self.message = message
self.details = details or {}
super().__init__(message)
def missing():
return GatewayError(404, "RESOURCE_NOT_FOUND", "资源不存在或无权访问。")
def conflict(code="VERSION_CONFLICT", message="资源版本已改变,请刷新后重试。", **details):
return GatewayError(409, code, message, details)