Spaces:
Running
Running
Add error handling for image loading in list_emails function
Browse files- app/controllers/mail.py +4 -1
app/controllers/mail.py
CHANGED
@@ -139,7 +139,10 @@ def list_emails(service, messages):
|
|
139 |
if part["mimeType"] == "application/pdf":
|
140 |
attach_docs = PyPDFLoader(path).load()
|
141 |
elif part["mimeType"] == "image/png" or part["mimeType"] == "image/jpeg":
|
142 |
-
|
|
|
|
|
|
|
143 |
elif part["filename"].endswith(".csv"):
|
144 |
attach_docs = CSVLoader(path).load()
|
145 |
elif (
|
|
|
139 |
if part["mimeType"] == "application/pdf":
|
140 |
attach_docs = PyPDFLoader(path).load()
|
141 |
elif part["mimeType"] == "image/png" or part["mimeType"] == "image/jpeg":
|
142 |
+
try:
|
143 |
+
attach_docs = UnstructuredImageLoader(path).load()
|
144 |
+
except Exception as e:
|
145 |
+
logger.error("Error loading image: %s", e)
|
146 |
elif part["filename"].endswith(".csv"):
|
147 |
attach_docs = CSVLoader(path).load()
|
148 |
elif (
|