Skip to content

Commit 00ea990

Browse files
committed
Sentry: ignore logging known exceptions
By reading https://docs.sentry.io/clients/python/integrations/#additional-settings it seems that we should be able to ignore known exceptions to be sent to Sentry. Note that we have this setting already defined at https://github.com/readthedocs/readthedocs.org/blob/b5908b0fc65cb02fc840b23eeb4218b3115b6590/readthedocs/settings/base.py#L453 However, we need to add these known exceptions to https://github.com/readthedocs/readthedocs.org/blob/b5908b0fc65cb02fc840b23eeb4218b3115b6590/readthedocs/projects/tasks/builds.py#L224-L229 This commit adds the known exceptions to be ignored by Celery and not sent to Sentry either.
1 parent b5908b0 commit 00ea990

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

readthedocs/projects/tasks/builds.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
DuplicatedBuildError,
5454
ProjectBuildsSkippedError,
5555
YAMLParseError,
56+
MkDocsYAMLParseError,
5657
)
5758
from readthedocs.doc_builder.loader import get_builder_class
5859
from readthedocs.doc_builder.python_environments import Conda, Virtualenv
@@ -62,7 +63,7 @@
6263
from readthedocs.worker import app
6364

6465

65-
from ..exceptions import RepositoryError
66+
from ..exceptions import RepositoryError, ProjectConfigurationError
6667
from ..models import APIProject, Feature, WebHookEvent, HTMLFile, ImportedFile, Project
6768
from ..signals import (
6869
after_build,
@@ -220,12 +221,21 @@ class UpdateDocsTask(SyncRepositoryMixin, Task):
220221
max_retries = 5 # 5 per normal builds, 25 per concurrency limited
221222
default_retry_delay = 7 * 60
222223

223-
# Expected exceptions that will be logged as info only and not retried
224+
# Expected exceptions that will be logged as info only and not retried.
225+
# These exceptions are not sent to Sentry either because we are using
226+
# ``SENTRY_CELERY_IGNORE_EXPECTED=True``.
227+
#
228+
# All exceptions generated by a user miss-configuration should be listed
229+
# here. Actually, every subclass of ``BuildUserError``.
224230
throws = (
225231
DuplicatedBuildError,
226232
ProjectBuildsSkippedError,
227233
ConfigError,
228234
YAMLParseError,
235+
BuildUserError,
236+
RepositoryError,
237+
MkDocsYAMLParseError,
238+
ProjectConfigurationError,
229239
)
230240

231241
acks_late = True

0 commit comments

Comments
 (0)