Spaces:
Running
Running
Download src/free_claude_code/application/errors.py from dherain24/claude-proxy: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/dherain24/claude-proxy/resolve/main/src/free_claude_code/application/errors.py
- Command line
-
hf download hf://spaces/dherain24/claude-proxy/src/free_claude_code/application/errors.py
-
curl -L -o errors.py https://huggingface.co/spaces/dherain24/claude-proxy/resolve/main/src/free_claude_code/application/errors.py
1.29 kB
| from __future__ import annotations | |
| """Deterministic application and readiness errors.""" | |
| from collections.abc import Iterable | |
| from free_claude_code.core.failures import FailureKind | |
| class ApplicationError(Exception): | |
| """Base for request/readiness failures, not finalized upstream failures.""" | |
| kind: FailureKind | |
| status_code: int | |
| def __init__(self, message: str, *, error_code: str | None = None) -> None: | |
| super().__init__(message) | |
| self.message = message | |
| self.error_code = error_code | |
| class InvalidRequestError(ApplicationError): | |
| """The accepted request cannot be executed deterministically.""" | |
| kind = FailureKind.INVALID_REQUEST | |
| status_code = 400 | |
| class UnknownProviderError(InvalidRequestError): | |
| """The configured provider identifier is not registered.""" | |
| def for_provider( | |
| cls, provider_id: str, supported_provider_ids: Iterable[str] | |
| ) -> UnknownProviderError: | |
| supported = "', '".join(supported_provider_ids) | |
| return cls(f"Unknown provider_type: '{provider_id}'. Supported: '{supported}'") | |
| class ApplicationUnavailableError(ApplicationError): | |
| """The application cannot currently provide a request runtime.""" | |
| kind = FailureKind.UNAVAILABLE | |
| status_code = 503 | |