Spaces:
Running
Running
Download bl_ocr/core/errors.py from youssefboutaleb/BL: direct link, hf CLI and curl.
- Browser
- Download file 644 Bytes
-
https://huggingface.co/spaces/youssefboutaleb/BL/resolve/main/bl_ocr/core/errors.py
- Command line
-
hf download hf://spaces/youssefboutaleb/BL/bl_ocr/core/errors.py
-
curl -L -o errors.py https://huggingface.co/spaces/youssefboutaleb/BL/resolve/main/bl_ocr/core/errors.py
644 Bytes
| from __future__ import annotations | |
| class OcrServiceError(Exception): | |
| """Base exception for OCR service failures.""" | |
| class OcrProviderError(OcrServiceError): | |
| """Raised when the upstream OCR provider cannot complete the request.""" | |
| def __init__( | |
| self, | |
| message: str, | |
| *, | |
| status_code: int | None = None, | |
| response_body: str | None = None, | |
| ) -> None: | |
| super().__init__(message) | |
| self.status_code = status_code | |
| self.response_body = response_body | |
| class InvalidImageError(OcrServiceError): | |
| """Raised when an uploaded payload is empty, too large, or unsupported.""" | |