Spaces:
Running
Running
File size: 644 Bytes
e4e6ceb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 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."""
|