Skip to content

Commit

Permalink
Handle 401, 403 and 404 status codes when hitting GitHub for webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
humitos committed Oct 24, 2018
1 parent 7b47841 commit 53928f0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions readthedocs/oauth/services/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ def setup_webhook(self, project):
log.info('GitHub webhook creation successful for project: %s',
project)
return (True, resp)
elif resp.status_code in [401, 403, 404]:
log.info(
'GitHub project does not exist or user does not have '
'permissions: project=%s',
project,
)
return (False, resp)
# Catch exceptions with request or deserializing JSON
except (RequestException, ValueError):
log.exception(
Expand Down

0 comments on commit 53928f0

Please sign in to comment.