Download src/errors.py from BlueSkyXN/diffusiongemma-zerogpu-space: direct link, hf CLI and curl.
- Browser
- Download file 476 Bytes
-
https://huggingface.co/spaces/BlueSkyXN/diffusiongemma-zerogpu-space/resolve/main/src/errors.py
- Command line
-
hf download hf://spaces/BlueSkyXN/diffusiongemma-zerogpu-space/src/errors.py
-
curl -L -o errors.py https://huggingface.co/spaces/BlueSkyXN/diffusiongemma-zerogpu-space/resolve/main/src/errors.py
476 Bytes
| from __future__ import annotations | |
| from dataclasses import dataclass | |
| from typing import Any | |
| class ApiError(Exception): | |
| code: str | |
| message: str | |
| status_code: int = 400 | |
| def __str__(self) -> str: | |
| return f"{self.code}: {self.message}" | |
| def public_error_payload(exc: ApiError) -> dict[str, Any]: | |
| return { | |
| "error": { | |
| "code": exc.code, | |
| "message": exc.message, | |
| "type": "api_error", | |
| } | |
| } | |