Skip to content

Commit 263b848

Browse files
Use StrEnum for DoclingTaskState; chain exception
Switch DoclingTaskState to StrEnum (imported from enum) so enum members are proper string enums. Also preserve the original error context in LangflowFileService by raising the upload exception with "from e" to keep exception chaining and traceback information.
1 parent 3190e9f commit 263b848

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/services/docling_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import json
33
import platform
44
from dataclasses import dataclass
5-
from enum import Enum
5+
from enum import StrEnum
66
from pathlib import Path
77
from typing import Any
88

@@ -34,7 +34,7 @@ class DoclingServeError(Exception):
3434
"""Raised when docling-serve conversion fails."""
3535

3636

37-
class DoclingTaskState(str, Enum):
37+
class DoclingTaskState(StrEnum):
3838
"""Result of a single status check against Docling Serve."""
3939

4040
PENDING = "pending"

src/services/langflow_file_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ async def submit_to_docling(self, filename: str, content: bytes, jwt_token: str
541541
"[LF] Docling submission failed",
542542
extra={"error": str(e), "filename": filename},
543543
)
544-
raise Exception(f"Docling upload failed: {str(e)}")
544+
raise Exception(f"Docling upload failed: {str(e)}") from e
545545

546546
async def upload_and_ingest_file(
547547
self,

0 commit comments

Comments
 (0)