Skip to content

Commit f8f4c85

Browse files
committed
Re-raise the proper exception when syncing the repo (sync_repo)
Depending on the exception, we want to log at different levels and in all the cases stop the build (execute `raise` again).
1 parent bec8acd commit f8f4c85

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

readthedocs/projects/tasks.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,14 +626,17 @@ def setup_vcs(self):
626626
try:
627627
self.sync_repo()
628628
except RepositoryError:
629-
# Do not log as ERROR handled exceptions
630629
log.warning('There was an error with the repository', exc_info=True)
630+
# Re raise the exception to stop the build at this point
631+
raise
631632
except vcs_support_utils.LockTimeout:
632633
log.info(
633634
'Lock still active: project=%s version=%s',
634635
self.project.slug,
635636
self.version.slug,
636637
)
638+
# Raise the proper exception (won't be sent to Sentry)
639+
raise VersionLockedError
637640
except Exception:
638641
# Catch unhandled errors when syncing
639642
log.exception(
@@ -647,6 +650,8 @@ def setup_vcs(self):
647650
},
648651
},
649652
)
653+
# Re raise the exception to stop the build at this point
654+
raise
650655

651656
commit = self.project.vcs_repo(self.version.slug).commit
652657
if commit:

0 commit comments

Comments
 (0)