Skip to content

Commit ed8dd29

Browse files
authored
Merge pull request readthedocs#5326 from stsewd/protect-against-api-failure
Don't depend on specific data when catching exception
2 parents 55105bb + 8376557 commit ed8dd29

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

readthedocs/projects/tasks.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,11 @@ def run(
390390
'stack': True,
391391
'tags': {
392392
'build': build_pk,
393-
'project': self.project.slug,
394-
'version': self.version.slug,
393+
# We can't depend on these objects because the api
394+
# could fail. But self.project and self.version are
395+
# initialized as empty dicts in the init method.
396+
'project': self.project.slug if self.project else None,
397+
'version': self.version.slug if self.version else None,
395398
},
396399
},
397400
)

0 commit comments

Comments
 (0)