Skip to content

Commit 392ff56

Browse files
authored
Merge pull request #4805 from rtfd/humitos/integrations/handle-error-codes
Handle 401, 403 and 404 status codes when hitting GitHub for webhook
2 parents 78e5b7a + 2ae1c26 commit 392ff56

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

readthedocs/oauth/services/github.py

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

0 commit comments

Comments
 (0)