28 lines
723 B
Python
28 lines
723 B
Python
"""Typed convert / validation error codes (Firecrawl anydoc-inspired taxonomy)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from enum import Enum
|
|
|
|
|
|
class ConvertErrorCode(str, Enum):
|
|
unsupported = "unsupported"
|
|
encrypted = "encrypted"
|
|
needs_ocr = "needs_ocr"
|
|
malformed = "malformed"
|
|
resource_limit = "resource_limit"
|
|
missing_part = "missing_part"
|
|
io = "io"
|
|
|
|
|
|
# Default HTTP status per code
|
|
HTTP_STATUS: dict[ConvertErrorCode, int] = {
|
|
ConvertErrorCode.unsupported: 415,
|
|
ConvertErrorCode.encrypted: 400,
|
|
ConvertErrorCode.needs_ocr: 422,
|
|
ConvertErrorCode.malformed: 400,
|
|
ConvertErrorCode.resource_limit: 413,
|
|
ConvertErrorCode.missing_part: 400,
|
|
ConvertErrorCode.io: 400,
|
|
}
|