Handle dateparser ValueErrors

When parsing dates from the document text or filenames, correctly handle values
errors indicating broken dates. Newly added tests ensure that this handling
works properly.
This commit is contained in:
Johannes Wienke committed 2020-03-08 18:44:15 +01:00
1 parent a3aab0cb48
commit a311cd498c
2 files changed
+28 -2

No files matched your search

+2 -2
View File
@@ -108,7 +108,7 @@ class DocumentParser:
try:
date = __parser(date_string, self.FILENAME_DATE_ORDER)
except TypeError:
except (TypeError, ValueError):
# Skip all matches that do not parse to a proper date
continue
@@ -134,7 +134,7 @@ class DocumentParser:
try:
date = __parser(date_string, self.DATE_ORDER)
except TypeError:
except (TypeError, ValueError):
# Skip all matches that do not parse to a proper date
continue