Compare commits

...

1 Commits

Author SHA1 Message Date
Logan Markewich fa545c0d50 improve error handling 2024-10-02 18:48:34 -06:00
2 changed files with 11 additions and 2 deletions
+10 -1
View File
@@ -308,7 +308,8 @@ class LlamaParse(BasePydanticReader):
continue
# Allowed values "PENDING", "SUCCESS", "ERROR", "CANCELED"
status = result.json()["status"]
result_json = result.json()
status = result_json["status"]
if status == "SUCCESS":
parsed_result = await client.get(result_url, headers=headers)
return parsed_result.json()
@@ -320,6 +321,14 @@ class LlamaParse(BasePydanticReader):
print(".", end="", flush=True)
await asyncio.sleep(self.check_interval)
else:
error_code = result_json.get("error_code", "No error code found")
error_message = result_json.get(
"error_message", "No error message found"
)
exception_str = f"Job ID: {job_id} failed with status: {status}, Error code: {error_code}, Error message: {error_message}"
raise Exception(exception_str)
async def _aload_data(
self,
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "llama-parse"
version = "0.5.6"
version = "0.5.7"
description = "Parse files into RAG-Optimized formats."
authors = ["Logan Markewich <logan@llamaindex.ai>"]
license = "MIT"