Skip to content

Commit e17d0cd

Browse files
committed
Handle 401, 403 and 404 status codes when hitting GitHub for webhook
1 parent 78e5b7a commit e17d0cd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

readthedocs/oauth/services/github.py

+7
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ def setup_webhook(self, project):
207207
log.info('GitHub webhook creation successful for project: %s',
208208
project)
209209
return (True, resp)
210+
elif resp.status_code in [401, 403, 404]:
211+
log.info(
212+
'GitHub project does not exist or user does not have '
213+
'permissions: project=%s',
214+
project,
215+
)
216+
return (False, resp)
210217
# Catch exceptions with request or deserializing JSON
211218
except (RequestException, ValueError):
212219
log.exception(

0 commit comments

Comments
 (0)