Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Don't allow an exception when trying to parse a date cause complete failure

Trenton H914661fdbb7a
diff --git a/src/documents/consumer.py b/src/documents/consumer.py
index f542a1d98..d81380191 100644
--- a/src/documents/consumer.py
+++ b/src/documents/consumer.py
@@ -444,7 +444,12 @@ class Consumer(LoggingMixin):
return document
- def _store(self, text, date, mime_type) -> Document:
+ def _store(
+ self,
+ text: str,
+ date: Optional[datetime.datetime],
+ mime_type: str,
+ ) -> Document:
# If someone gave us the original filename, use it instead of doc.
diff --git a/src/documents/parsers.py b/src/documents/parsers.py
index f62199677..e2309b366 100644
--- a/src/documents/parsers.py
+++ b/src/documents/parsers.py
@@ -260,7 +260,7 @@ def parse_date_generator(filename, text) -> Iterator[datetime.datetime]:
try:
date = __parser(date_string, date_order)
- except (TypeError, ValueError):
+ except Exception:
# Skip all matches that do not parse to a proper date
date = None