52
52
BuildEnvironmentError ,
53
53
BuildEnvironmentWarning ,
54
54
BuildTimeoutError ,
55
+ MkDocsYAMLParseError ,
55
56
ProjectBuildsSkippedError ,
56
57
VersionLockedError ,
57
58
YAMLParseError ,
64
65
from readthedocs .worker import app
65
66
66
67
from .constants import LOG_TEMPLATE
67
- from .exceptions import RepositoryError
68
+ from .exceptions import ProjectConfigurationError , RepositoryError
68
69
from .models import Domain , HTMLFile , ImportedFile , Project
69
70
from .signals import (
70
71
after_build ,
@@ -264,6 +265,10 @@ def run(self, version_pk): # pylint: disable=arguments-differ
264
265
return False
265
266
266
267
268
+ # Exceptions under ``throws`` argument are considered ERROR from a Build
269
+ # perspective (the build failed and can continue) but as a WARNING for the
270
+ # application itself (RTD code didn't failed). These exception are logged as
271
+ # ``INFO`` and they are not sent to Sentry.
267
272
@app .task (
268
273
bind = True ,
269
274
max_retries = 5 ,
@@ -273,7 +278,11 @@ def run(self, version_pk): # pylint: disable=arguments-differ
273
278
ProjectBuildsSkippedError ,
274
279
YAMLParseError ,
275
280
BuildTimeoutError ,
281
+ BuildEnvironmentWarning ,
282
+ RepositoryError ,
283
+ ProjectConfigurationError ,
276
284
ProjectBuildsSkippedError ,
285
+ MkDocsYAMLParseError ,
277
286
),
278
287
)
279
288
def update_docs_task (self , project_id , * args , ** kwargs ):
@@ -604,8 +613,6 @@ def setup_vcs(self):
604
613
Update the checkout of the repo to make sure it's the latest.
605
614
606
615
This also syncs versions in the DB.
607
-
608
- :param build_env: Build environment
609
616
"""
610
617
self .setup_env .update_build (state = BUILD_STATE_CLONING )
611
618
@@ -619,14 +626,17 @@ def setup_vcs(self):
619
626
try :
620
627
self .sync_repo ()
621
628
except RepositoryError :
622
- # Do not log as ERROR handled exceptions
623
629
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
624
632
except vcs_support_utils .LockTimeout :
625
633
log .info (
626
634
'Lock still active: project=%s version=%s' ,
627
635
self .project .slug ,
628
636
self .version .slug ,
629
637
)
638
+ # Raise the proper exception (won't be sent to Sentry)
639
+ raise VersionLockedError
630
640
except Exception :
631
641
# Catch unhandled errors when syncing
632
642
log .exception (
@@ -640,6 +650,8 @@ def setup_vcs(self):
640
650
},
641
651
},
642
652
)
653
+ # Re raise the exception to stop the build at this point
654
+ raise
643
655
644
656
commit = self .project .vcs_repo (self .version .slug ).commit
645
657
if commit :
@@ -1044,7 +1056,7 @@ def symlink_project(project_pk):
1044
1056
sym .run ()
1045
1057
1046
1058
1047
- @app .task (queue = 'web' , throws = ( BuildEnvironmentWarning ,) )
1059
+ @app .task (queue = 'web' )
1048
1060
def symlink_domain (project_pk , domain , delete = False ):
1049
1061
"""
1050
1062
Symlink domain.
@@ -1093,7 +1105,7 @@ def broadcast_remove_orphan_symlinks():
1093
1105
broadcast (type = 'web' , task = remove_orphan_symlinks , args = [])
1094
1106
1095
1107
1096
- @app .task (queue = 'web' , throws = ( BuildEnvironmentWarning ,) )
1108
+ @app .task (queue = 'web' )
1097
1109
def symlink_subproject (project_pk ):
1098
1110
project = Project .objects .get (pk = project_pk )
1099
1111
for symlink in [PublicSymlink , PrivateSymlink ]:
0 commit comments