2026-04-06 22:51:04 +08:00
|
|
|
class PageIndexError(Exception):
|
|
|
|
|
"""Base exception for all PageIndex SDK errors."""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CollectionNotFoundError(PageIndexError):
|
|
|
|
|
"""Collection does not exist."""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DocumentNotFoundError(PageIndexError):
|
|
|
|
|
"""Document ID not found."""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class IndexingError(PageIndexError):
|
|
|
|
|
"""Indexing pipeline failure."""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
2026-05-11 21:06:23 +08:00
|
|
|
class PageIndexAPIError(PageIndexError):
|
|
|
|
|
"""PageIndex cloud API returned an error.
|
|
|
|
|
|
|
|
|
|
Kept for compatibility with the pageindex 0.2.x cloud SDK.
|
|
|
|
|
"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CloudAPIError(PageIndexAPIError):
|
2026-07-07 09:40:09 +08:00
|
|
|
"""Cloud API returned error.
|
|
|
|
|
|
|
|
|
|
``status_code`` carries the HTTP status when the error came from an HTTP
|
|
|
|
|
response (None for transport-level failures), so callers can branch on it
|
|
|
|
|
instead of parsing the message.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def __init__(self, message: str, status_code: int | None = None):
|
|
|
|
|
super().__init__(message)
|
|
|
|
|
self.status_code = status_code
|
2026-04-06 22:51:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class FileTypeError(PageIndexError):
|
|
|
|
|
"""Unsupported file type."""
|
|
|
|
|
pass
|