Spaces:
Sleeping
Sleeping
Download APIGateway/errors.py from dellweb3/workos-office: direct link, hf CLI and curl.
- Browser
- Download file 628 Bytes
-
https://huggingface.co/spaces/dellweb3/workos-office/resolve/main/APIGateway/errors.py
- Command line
-
hf download hf://spaces/dellweb3/workos-office/APIGateway/errors.py
-
curl -L -o errors.py https://huggingface.co/spaces/dellweb3/workos-office/resolve/main/APIGateway/errors.py
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) | |