From d24d3d1e8c9cdc7948678705d2f558b07a4102bc Mon Sep 17 00:00:00 2001
From: Alex Yang <himself65@outlook.com>
Date: Thu, 19 Sep 2024 09:41:37 -0700
Subject: [PATCH] fix: print warning when llama parse reader has error (#1230)

---
 .changeset/selfish-cobras-help.md | 5 +++++
 packages/cloud/src/reader.ts      | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 .changeset/selfish-cobras-help.md

diff --git a/.changeset/selfish-cobras-help.md b/.changeset/selfish-cobras-help.md
new file mode 100644
index 000000000..a2137d3ea
--- /dev/null
+++ b/.changeset/selfish-cobras-help.md
@@ -0,0 +1,5 @@
+---
+"@llamaindex/cloud": patch
+---
+
+fix: print warning when llama parse reader has error
diff --git a/packages/cloud/src/reader.ts b/packages/cloud/src/reader.ts
index 0be8fe8fa..0d2144400 100644
--- a/packages/cloud/src/reader.ts
+++ b/packages/cloud/src/reader.ts
@@ -403,6 +403,7 @@ export class LlamaParseReader extends FileReader {
       })
       .catch((error) => {
         if (this.ignoreErrors) {
+          console.warn(`Error while parsing the file: ${error.message}`);
           return [];
         } else {
           throw error;
@@ -437,8 +438,8 @@ export class LlamaParseReader extends FileReader {
       resultJson.file_path = isFilePath ? filePathOrContent : undefined;
       return [resultJson];
     } catch (e) {
-      console.error(`Error while parsing the file under job id ${jobId}`, e);
       if (this.ignoreErrors) {
+        console.error(`Error while parsing the file under job id ${jobId}`, e);
         return [];
       } else {
         throw e;
-- 
GitLab