Skip to content

Commit a577674

Browse files
authored
Merge pull request #159 from timvink/catch_errors
Catch errors explicitly
2 parents f5fa809 + d1527d7 commit a577674

File tree

1 file changed

+15
-0
lines changed
  • src/mkdocs_git_revision_date_localized_plugin

1 file changed

+15
-0
lines changed

src/mkdocs_git_revision_date_localized_plugin/util.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,21 @@ def get_git_commit_timestamp(
166166
" To ignore this error, set option 'fallback_to_build_date: true'"
167167
)
168168
raise err
169+
except Exception as err:
170+
if self.config.get('fallback_to_build_date'):
171+
log(
172+
"[git-revision-date-localized-plugin] An unexpected error occurred: %s"
173+
" Option 'fallback_to_build_date' set to 'true': Falling back to build date"
174+
% str(err)
175+
)
176+
commit_timestamp = time.time()
177+
else:
178+
logger.error(
179+
"[git-revision-date-localized-plugin] An unexpected error occurred: %s"
180+
" To ignore this error, set option 'fallback_to_build_date: true'"
181+
% str(err)
182+
)
183+
raise err
169184

170185
# create timestamp
171186
if commit_timestamp == "":

0 commit comments

Comments
 (0)